pumuki 6.3.210 → 6.3.212

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.
@@ -30,6 +30,7 @@ import {
30
30
  hasSwiftLegacySwiftUiObservableWrapperUsage,
31
31
  hasSwiftMainThreadBlockingSleepUsage,
32
32
  hasSwiftMassiveViewControllerResponsibilityUsage,
33
+ hasSwiftMagicNumberLayoutUsage,
33
34
  hasSwiftMixedTestingFrameworksUsage,
34
35
  hasSwiftLegacyXCTestImportUsage,
35
36
  hasSwiftModernizableXCTestSuiteUsage,
@@ -41,6 +42,7 @@ import {
41
42
  hasSwiftNSManagedObjectBoundaryUsage,
42
43
  hasSwiftNSManagedObjectStateLeakUsage,
43
44
  hasSwiftNavigationViewUsage,
45
+ hasSwiftNonIBOutletImplicitlyUnwrappedOptionalUsage,
44
46
  hasSwiftObservableObjectUsage,
45
47
  hasSwiftOnTapGestureUsage,
46
48
  hasSwiftOperationQueueUsage,
@@ -317,6 +319,59 @@ let text = "URLSession.shared.dataTask"
317
319
  assert.equal(hasSwiftMassiveViewControllerResponsibilityUsage(ignored), false);
318
320
  });
319
321
 
322
+ test('hasSwiftNonIBOutletImplicitlyUnwrappedOptionalUsage detecta IUO fuera de IBOutlet', () => {
323
+ const source = `
324
+ final class CheckoutViewModel {
325
+ var selectedOrder: Order!
326
+ private let formatter: DateFormatter!
327
+ }
328
+ `;
329
+ const ignored = `
330
+ final class CheckoutViewController: UIViewController {
331
+ @IBOutlet weak var titleLabel: UILabel!
332
+ @IBOutlet
333
+ private weak var tableView: UITableView!
334
+ let text = "var selectedOrder: Order!"
335
+ // var selectedOrder: Order!
336
+ }
337
+ `;
338
+
339
+ assert.equal(hasSwiftNonIBOutletImplicitlyUnwrappedOptionalUsage(source), true);
340
+ assert.equal(hasSwiftNonIBOutletImplicitlyUnwrappedOptionalUsage(ignored), false);
341
+ });
342
+
343
+ test('hasSwiftMagicNumberLayoutUsage detecta numeros magicos de layout SwiftUI', () => {
344
+ const source = `
345
+ struct ProfileView: View {
346
+ var body: some View {
347
+ VStack(spacing: 12) {
348
+ Text("Profile")
349
+ .padding(16)
350
+ .frame(width: 320, height: 44)
351
+ }
352
+ }
353
+ }
354
+ `;
355
+ const constants = `
356
+ struct ProfileView: View {
357
+ private enum Metrics {
358
+ static let spacing: CGFloat = 12
359
+ static let cardPadding: CGFloat = 16
360
+ }
361
+
362
+ var body: some View {
363
+ VStack(spacing: Metrics.spacing) {
364
+ Text("Profile")
365
+ .padding(Metrics.cardPadding)
366
+ }
367
+ }
368
+ }
369
+ `;
370
+
371
+ assert.equal(hasSwiftMagicNumberLayoutUsage(source), true);
372
+ assert.equal(hasSwiftMagicNumberLayoutUsage(constants), false);
373
+ });
374
+
320
375
  test('detectores de logging iOS detectan logs ad-hoc y PII en produccion', () => {
321
376
  const adHoc = `
322
377
  print(user.id)
@@ -544,6 +544,28 @@ export const hasSwiftMassiveViewControllerResponsibilityUsage = (source: string)
544
544
  return false;
545
545
  };
546
546
 
547
+ export const hasSwiftNonIBOutletImplicitlyUnwrappedOptionalUsage = (source: string): boolean => {
548
+ const lines = source.split(/\r?\n/);
549
+ const implicitlyUnwrappedPropertyPattern =
550
+ /\b(?:var|let)\s+[A-Za-z_][A-Za-z0-9_]*\s*:\s*(?:[A-Za-z_][A-Za-z0-9_.<>?]*\s*)!\s*(?:[=,{]|$)/;
551
+
552
+ return lines.some((line, index) => {
553
+ const sanitizedLine = stripSwiftLineForSemanticScan(line);
554
+ if (!implicitlyUnwrappedPropertyPattern.test(sanitizedLine)) {
555
+ return false;
556
+ }
557
+ const previousLine = index > 0 ? stripSwiftLineForSemanticScan(lines[index - 1] ?? '') : '';
558
+ return !/\B@IBOutlet\b/.test(`${previousLine} ${sanitizedLine}`);
559
+ });
560
+ };
561
+
562
+ export const hasSwiftMagicNumberLayoutUsage = (source: string): boolean => {
563
+ const swiftUiLayoutNumberPattern =
564
+ /(?:\b(?:VStack|HStack|ZStack|LazyVStack|LazyHStack)\s*\([^)]*\bspacing\s*:\s*|\.(?:padding|frame|offset|position|shadow|blur)\s*\([^)]*(?:\b(?:width|height|spacing|radius|x|y)\s*:\s*)?)\b(?:[3-9]|[1-9][0-9]+)(?:\.[0-9]+)?\b/;
565
+
566
+ return collectSwiftRegexLines(source, swiftUiLayoutNumberPattern).length > 0;
567
+ };
568
+
547
569
  export const hasSwiftAdHocLoggingUsage = (source: string): boolean => {
548
570
  return collectSwiftRegexLines(
549
571
  source,
@@ -650,6 +650,8 @@ const textDetectorRegistry: ReadonlyArray<TextDetectorRegistryEntry> = [
650
650
  { platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftStrongSelfEscapingClosureUsage, ruleId: 'heuristics.ios.memory.strong-self-escaping-closure.ast', code: 'HEURISTICS_IOS_MEMORY_STRONG_SELF_ESCAPING_CLOSURE_AST', message: 'AST heuristic detected strong self capture in an escaping iOS closure; weak or unowned captures remain the preferred baseline when ownership is not explicit.' },
651
651
  { platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftCustomSingletonUsage, ruleId: 'heuristics.ios.architecture.custom-singleton.ast', code: 'HEURISTICS_IOS_ARCHITECTURE_CUSTOM_SINGLETON_AST', message: 'AST heuristic detected a custom static shared singleton in iOS production code; dependency injection remains the preferred baseline for app-owned services.' },
652
652
  { platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftMassiveViewControllerResponsibilityUsage, ruleId: 'heuristics.ios.architecture.massive-view-controller.ast', code: 'HEURISTICS_IOS_ARCHITECTURE_MASSIVE_VIEW_CONTROLLER_AST', message: 'AST heuristic detected a UIViewController with direct infrastructure/data access; move data access behind application/domain boundaries.' },
653
+ { platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftNonIBOutletImplicitlyUnwrappedOptionalUsage, ruleId: 'heuristics.ios.safety.non-iboutlet-iuo.ast', code: 'HEURISTICS_IOS_SAFETY_NON_IBOUTLET_IUO_AST', message: 'AST heuristic detected an implicitly unwrapped optional outside IBOutlet wiring; explicit optionals or initialization guarantees remain the preferred baseline.' },
654
+ { platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftMagicNumberLayoutUsage, ruleId: 'heuristics.ios.maintainability.magic-number-layout.ast', code: 'HEURISTICS_IOS_MAINTAINABILITY_MAGIC_NUMBER_LAYOUT_AST', message: 'AST heuristic detected SwiftUI layout magic numbers; named constants or design tokens remain the preferred baseline.' },
653
655
  { platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftAdHocLoggingUsage, ruleId: 'heuristics.ios.logging.adhoc-print.ast', code: 'HEURISTICS_IOS_LOGGING_ADHOC_PRINT_AST', message: 'AST heuristic detected print/debugPrint/dump/NSLog/os_log usage in iOS production code.' },
654
656
  { platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftSensitiveLoggingUsage, ruleId: 'heuristics.ios.logging.sensitive-data.ast', code: 'HEURISTICS_IOS_LOGGING_SENSITIVE_DATA_AST', message: 'AST heuristic detected sensitive data in an iOS logging call.' },
655
657
  { platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftAlamofireUsage, ruleId: 'heuristics.ios.networking.alamofire.ast', code: 'HEURISTICS_IOS_NETWORKING_ALAMOFIRE_AST', message: 'AST heuristic detected Alamofire usage in iOS production code; URLSession remains the preferred baseline for new code.' },
@@ -257,6 +257,44 @@ export const iosRules: RuleSet = [
257
257
  code: 'HEURISTICS_IOS_ARCHITECTURE_MASSIVE_VIEW_CONTROLLER_AST',
258
258
  },
259
259
  },
260
+ {
261
+ id: 'heuristics.ios.maintainability.magic-number-layout.ast',
262
+ description: 'Detects SwiftUI layout magic numbers in presentation code.',
263
+ severity: 'WARN',
264
+ platform: 'ios',
265
+ locked: true,
266
+ when: {
267
+ kind: 'Heuristic',
268
+ where: {
269
+ ruleId: 'heuristics.ios.maintainability.magic-number-layout.ast',
270
+ },
271
+ },
272
+ then: {
273
+ kind: 'Finding',
274
+ message:
275
+ 'AST heuristic detected SwiftUI layout magic numbers; named constants or design tokens remain the preferred baseline.',
276
+ code: 'HEURISTICS_IOS_MAINTAINABILITY_MAGIC_NUMBER_LAYOUT_AST',
277
+ },
278
+ },
279
+ {
280
+ id: 'heuristics.ios.safety.non-iboutlet-iuo.ast',
281
+ description: 'Detects implicitly unwrapped optionals outside IBOutlet wiring.',
282
+ severity: 'WARN',
283
+ platform: 'ios',
284
+ locked: true,
285
+ when: {
286
+ kind: 'Heuristic',
287
+ where: {
288
+ ruleId: 'heuristics.ios.safety.non-iboutlet-iuo.ast',
289
+ },
290
+ },
291
+ then: {
292
+ kind: 'Finding',
293
+ message:
294
+ 'AST heuristic detected an implicitly unwrapped optional outside IBOutlet wiring; explicit optionals or initialization guarantees remain the preferred baseline.',
295
+ code: 'HEURISTICS_IOS_SAFETY_NON_IBOUTLET_IUO_AST',
296
+ },
297
+ },
260
298
  {
261
299
  id: 'heuristics.ios.logging.adhoc-print.ast',
262
300
  description: 'Detects print/debugPrint/dump/NSLog/os_log usage in iOS production code.',
@@ -74,6 +74,18 @@ const registryByRuleId: Record<string, SkillsDetectorBinding> = {
74
74
  'ios.architecture.massive-view-controller',
75
75
  ['heuristics.ios.architecture.massive-view-controller.ast']
76
76
  ),
77
+ 'skills.ios.guideline.ios.implicitly-unwrapped-solo-para-iboutlets-y-casos-muy-especi-ficos': heuristicDetector(
78
+ 'ios.safety.non-iboutlet-iuo',
79
+ ['heuristics.ios.safety.non-iboutlet-iuo.ast']
80
+ ),
81
+ 'skills.ios.guideline.ios.singletons-dificultan-testing': heuristicDetector(
82
+ 'ios.architecture.custom-singleton',
83
+ ['heuristics.ios.architecture.custom-singleton.ast']
84
+ ),
85
+ 'skills.ios.guideline.ios.magic-numbers-usar-constantes-con-nombres': heuristicDetector(
86
+ 'ios.maintainability.magic-number-layout',
87
+ ['heuristics.ios.maintainability.magic-number-layout.ast']
88
+ ),
77
89
  'skills.ios.guideline.ios.prohibido-print-y-logs-ad-hoc': heuristicDetector(
78
90
  'ios.logging.adhoc-print',
79
91
  ['heuristics.ios.logging.adhoc-print.ast']
@@ -453,6 +453,22 @@ const normalizeKnownRuleTarget = (
453
453
  ) {
454
454
  return 'skills.ios.guideline.ios.massive-view-controllers-viewcontrollers-que-mezclan-presentacio-n-nav';
455
455
  }
456
+ if (
457
+ includes('implicitly unwrapped') ||
458
+ includes('implicit unwrapped') ||
459
+ includes('iboutlet') ||
460
+ includes('iboutlets')
461
+ ) {
462
+ return 'skills.ios.guideline.ios.implicitly-unwrapped-solo-para-iboutlets-y-casos-muy-especi-ficos';
463
+ }
464
+ if (
465
+ includes('magic numbers') ||
466
+ includes('magic number') ||
467
+ includes('constantes con nombres') ||
468
+ includes('named constants')
469
+ ) {
470
+ return 'skills.ios.guideline.ios.magic-numbers-usar-constantes-con-nombres';
471
+ }
456
472
  if (
457
473
  includes('mixing legacy xctest style') ||
458
474
  includes('mixed xctest and swift testing') ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki",
3
- "version": "6.3.210",
3
+ "version": "6.3.212",
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": {
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-13T12:51:35.774Z",
4
+ "generatedAt": "2026-05-13T13:06:24.412Z",
5
5
  "bundles": [
6
6
  {
7
7
  "name": "android-guidelines",
@@ -5764,7 +5764,7 @@
5764
5764
  "name": "ios-guidelines",
5765
5765
  "version": "1.0.0",
5766
5766
  "source": "file:vendor/skills/ios-enterprise-rules/SKILL.md",
5767
- "hash": "ad016db5ad38077a418d0bf7c3780b5ae8ff2bfc724691038a65292acc500787",
5767
+ "hash": "01dc99563d48bb48b8df3262a7c58ca1482c3dd96590b9dd230d2576fa32f7b4",
5768
5768
  "rules": [
5769
5769
  {
5770
5770
  "id": "skills.ios.guideline.ios.accessibility-identifiers-para-localizar-elementos",
@@ -6736,7 +6736,7 @@
6736
6736
  "sourcePath": "vendor/skills/ios-enterprise-rules/SKILL.md",
6737
6737
  "confidence": "MEDIUM",
6738
6738
  "locked": true,
6739
- "evaluationMode": "DECLARATIVE",
6739
+ "evaluationMode": "AUTO",
6740
6740
  "origin": "core"
6741
6741
  },
6742
6742
  {
@@ -6916,7 +6916,7 @@
6916
6916
  "sourcePath": "vendor/skills/ios-enterprise-rules/SKILL.md",
6917
6917
  "confidence": "HIGH",
6918
6918
  "locked": true,
6919
- "evaluationMode": "DECLARATIVE",
6919
+ "evaluationMode": "AUTO",
6920
6920
  "origin": "core"
6921
6921
  },
6922
6922
  {