pumuki 6.3.244 → 6.3.246

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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,18 @@ This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [6.3.246] - 2026-05-14
10
+
11
+ ### Added
12
+
13
+ - **SwiftUI view-identity parity:** `skills.ios.guideline.ios-swiftui-expert.prefer-modifiers-over-conditional-views-for-state-changes-maintains-vi` now maps to a conservative AUTO heuristic for `if/else` branches that rebuild the same SwiftUI View type for state-only visual changes, preserving legitimate conditional composition.
14
+
15
+ ## [6.3.245] - 2026-05-14
16
+
17
+ ### Added
18
+
19
+ - **SwiftUI props fan-out parity:** `skills.ios.guideline.ios-swiftui-expert.pass-only-needed-values-to-views-avoid-large-config-or-context-objects` now maps to a scoped AUTO heuristic that detects SwiftUI Views storing broad `Config`/`Configuration`/`Context` properties, preserving narrow value props as the clean baseline.
20
+
9
21
  ## [6.3.244] - 2026-05-14
10
22
 
11
23
  ### Added
@@ -73,6 +73,8 @@ import {
73
73
  hasSwiftJSONSerializationUsage,
74
74
  hasSwiftExplicitColorStaticMemberUsage,
75
75
  hasSwiftClosureBasedViewBuilderContentUsage,
76
+ hasSwiftLargeConfigContextViewPropertyUsage,
77
+ hasSwiftUiConditionalSameViewIdentityUsage,
76
78
  hasSwiftRedundantReactiveStateAssignmentUsage,
77
79
  hasSwiftInlineForEachTransformUsage,
78
80
  hasSwiftStringFormatUsage,
@@ -1304,6 +1306,52 @@ let ignored = "let content: () -> Content"
1304
1306
  assert.equal(hasSwiftClosureBasedViewBuilderContentUsage(safe), false);
1305
1307
  });
1306
1308
 
1309
+ test('hasSwiftLargeConfigContextViewPropertyUsage detecta config/context grandes en SwiftUI View', () => {
1310
+ const source = `
1311
+ struct CheckoutSummaryView: View {
1312
+ let config: CheckoutSummaryConfiguration
1313
+ let title: String
1314
+
1315
+ var body: some View {
1316
+ VStack {
1317
+ Text(config.title)
1318
+ }
1319
+ }
1320
+ }
1321
+
1322
+ struct StoreMapView: View {
1323
+ var context: StoreMapContext
1324
+
1325
+ var body: some View {
1326
+ Text(context.title)
1327
+ }
1328
+ }
1329
+ `;
1330
+ const safe = `
1331
+ struct CheckoutSummaryView: View {
1332
+ let title: String
1333
+ let subtitle: String
1334
+
1335
+ var body: some View {
1336
+ VStack {
1337
+ Text(title)
1338
+ Text(subtitle)
1339
+ }
1340
+ }
1341
+ }
1342
+
1343
+ final class CheckoutPresenter {
1344
+ let context: CheckoutContext
1345
+ }
1346
+
1347
+ let ignored = "struct IgnoredView: View { let config: AppConfig var body: some View { Text(config.title) } }"
1348
+ // struct IgnoredView: View { let config: AppConfig var body: some View { Text(config.title) } }
1349
+ `;
1350
+
1351
+ assert.equal(hasSwiftLargeConfigContextViewPropertyUsage(source), true);
1352
+ assert.equal(hasSwiftLargeConfigContextViewPropertyUsage(safe), false);
1353
+ });
1354
+
1307
1355
  test('hasSwiftRedundantReactiveStateAssignmentUsage detecta asignaciones reactivas redundantes y preserva guard de cambio', () => {
1308
1356
  const source = `
1309
1357
  struct SearchView: View {
@@ -2024,3 +2072,43 @@ final class PumukiLspIosCanaryPremiumDiscount: PumukiLspIosCanaryDiscountApplyin
2024
2072
  assert.match(match.impact, /sustitución|precondiciones|regresiones/i);
2025
2073
  assert.match(match.expected_fix, /contrato base|adaptador|estrategia/i);
2026
2074
  });
2075
+
2076
+ test('hasSwiftUiConditionalSameViewIdentityUsage detecta ramas que reconstruyen la misma View por estado visual', () => {
2077
+ const source = `
2078
+ struct StatusBadge: View {
2079
+ let isSelected: Bool
2080
+
2081
+ var body: some View {
2082
+ if isSelected {
2083
+ Text("Active")
2084
+ .foregroundStyle(.green)
2085
+ } else {
2086
+ Text("Active")
2087
+ .foregroundStyle(.secondary)
2088
+ }
2089
+ }
2090
+ }
2091
+ `;
2092
+ const safe = `
2093
+ struct StatusBadge: View {
2094
+ let isSelected: Bool
2095
+
2096
+ var body: some View {
2097
+ Text("Active")
2098
+ .foregroundStyle(isSelected ? .green : .secondary)
2099
+
2100
+ if isSelected {
2101
+ SuccessBadge()
2102
+ } else {
2103
+ EmptyView()
2104
+ }
2105
+
2106
+ let sample = "if isSelected { Text(\"Active\") } else { Text(\"Active\") }"
2107
+ // if isSelected { Text("Active") } else { Text("Active") }
2108
+ }
2109
+ }
2110
+ `;
2111
+
2112
+ assert.equal(hasSwiftUiConditionalSameViewIdentityUsage(source), true);
2113
+ assert.equal(hasSwiftUiConditionalSameViewIdentityUsage(safe), false);
2114
+ });
@@ -962,6 +962,63 @@ export const hasSwiftClosureBasedViewBuilderContentUsage = (source: string): boo
962
962
  );
963
963
  };
964
964
 
965
+ export const hasSwiftLargeConfigContextViewPropertyUsage = (source: string): boolean => {
966
+ const sanitized = sanitizeSwiftSourceForMultilineRegex(source);
967
+ const swiftUIViewPattern =
968
+ /\bstruct\s+[A-Za-z_][A-Za-z0-9_]*\s*:\s*View\s*\{[\s\S]{0,2200}?\bvar\s+body\s*:\s*some\s+View\s*\{/g;
969
+
970
+ for (const viewMatch of sanitized.matchAll(swiftUIViewPattern)) {
971
+ const viewSegment = viewMatch[0] ?? '';
972
+ if (
973
+ /\b(?:let|var)\s+(?:config|configuration|context)\s*:\s*[A-Za-z_][A-Za-z0-9_]*(?:Config|Configuration|Context)\b/.test(
974
+ viewSegment
975
+ )
976
+ ) {
977
+ return true;
978
+ }
979
+ }
980
+
981
+ return false;
982
+ };
983
+
984
+ const swiftIdentitySensitiveViewConstructors = [
985
+ 'Text',
986
+ 'Image',
987
+ 'Button',
988
+ 'Label',
989
+ 'HStack',
990
+ 'VStack',
991
+ 'ZStack',
992
+ 'Group',
993
+ 'RoundedRectangle',
994
+ 'Circle',
995
+ 'Capsule',
996
+ 'Rectangle',
997
+ ] as const;
998
+
999
+ export const hasSwiftUiConditionalSameViewIdentityUsage = (source: string): boolean => {
1000
+ const sanitized = sanitizeSwiftSourceForMultilineRegex(source);
1001
+ const swiftUIViewBodyPattern =
1002
+ /\bstruct\s+[A-Za-z_][A-Za-z0-9_]*\s*:\s*View\s*\{[\s\S]{0,2200}?\bvar\s+body\s*:\s*some\s+View\s*\{/m;
1003
+
1004
+ if (!swiftUIViewBodyPattern.test(sanitized)) {
1005
+ return false;
1006
+ }
1007
+
1008
+ for (const constructor of swiftIdentitySensitiveViewConstructors) {
1009
+ const escapedConstructor = escapeRegex(constructor);
1010
+ const sameViewBranchPattern = new RegExp(
1011
+ `\\bif\\s+[^{}]+\\{\\s*${escapedConstructor}\\s*(?:\\(|\\{|\\.)[\\s\\S]{0,600}?\\}\\s*else\\s*\\{\\s*${escapedConstructor}\\s*(?:\\(|\\{|\\.)`,
1012
+ 'm'
1013
+ );
1014
+ if (sameViewBranchPattern.test(sanitized)) {
1015
+ return true;
1016
+ }
1017
+ }
1018
+
1019
+ return false;
1020
+ };
1021
+
965
1022
  export const hasSwiftRedundantReactiveStateAssignmentUsage = (source: string): boolean => {
966
1023
  const sanitized = sanitizeSwiftSourceForMultilineRegex(source);
967
1024
  const reactiveAssignmentPattern =
@@ -689,6 +689,8 @@ const textDetectorRegistry: ReadonlyArray<TextDetectorRegistryEntry> = [
689
689
  { platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftFontWeightBoldUsage, ruleId: 'heuristics.ios.font-weight-bold.ast', code: 'HEURISTICS_IOS_FONT_WEIGHT_BOLD_AST', message: 'AST heuristic detected fontWeight(.bold) usage where bold() may be preferred.' },
690
690
  { platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftExplicitColorStaticMemberUsage, ruleId: 'heuristics.ios.swiftui.explicit-color-static-member.ast', code: 'HEURISTICS_IOS_SWIFTUI_EXPLICIT_COLOR_STATIC_MEMBER_AST', message: 'AST heuristic detected Color.* static member usage where SwiftUI static member lookup may be preferred.' },
691
691
  { platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftClosureBasedViewBuilderContentUsage, ruleId: 'heuristics.ios.swiftui.closure-based-viewbuilder-content.ast', code: 'HEURISTICS_IOS_SWIFTUI_CLOSURE_BASED_VIEWBUILDER_CONTENT_AST', message: 'AST heuristic detected closure-based content storage; @ViewBuilder let content: Content remains the preferred SwiftUI container baseline.' },
692
+ { platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftLargeConfigContextViewPropertyUsage, ruleId: 'heuristics.ios.swiftui.large-config-context-prop.ast', code: 'HEURISTICS_IOS_SWIFTUI_LARGE_CONFIG_CONTEXT_PROP_AST', message: 'AST heuristic detected a SwiftUI View storing a broad config/context object; pass only needed values to reduce update fan-out.' },
693
+ { platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftUiConditionalSameViewIdentityUsage, ruleId: 'heuristics.ios.swiftui.conditional-same-view-identity.ast', code: 'HEURISTICS_IOS_SWIFTUI_CONDITIONAL_SAME_VIEW_IDENTITY_AST', message: 'AST heuristic detected conditional branches rebuilding the same SwiftUI View type; prefer conditional modifiers or values to preserve view identity.' },
692
694
  { platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftRedundantReactiveStateAssignmentUsage, ruleId: 'heuristics.ios.swiftui.redundant-reactive-state-assignment.ast', code: 'HEURISTICS_IOS_SWIFTUI_REDUNDANT_REACTIVE_STATE_ASSIGNMENT_AST', message: 'AST heuristic detected reactive state assignment without a value-change guard; check for value changes before assigning state in hot paths.' },
693
695
  { platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftNonLazyScrollForEachUsage, ruleId: 'heuristics.ios.swiftui.non-lazy-scroll-foreach.ast', code: 'HEURISTICS_IOS_SWIFTUI_NON_LAZY_SCROLL_FOREACH_AST', message: 'AST heuristic detected ScrollView with a non-lazy stack feeding ForEach; LazyVStack/LazyHStack remain the preferred baseline for large scrollable collections.' },
694
696
  { platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftViewBodyObjectCreationUsage, ruleId: 'heuristics.ios.swiftui.body-object-creation.ast', code: 'HEURISTICS_IOS_SWIFTUI_BODY_OBJECT_CREATION_AST', message: 'AST heuristic detected formatter object creation inside SwiftUI body; keep body simple and move expensive objects out of render paths.' },
@@ -3,7 +3,7 @@ import test from 'node:test';
3
3
  import { iosRules } from './ios';
4
4
 
5
5
  test('iosRules define reglas heurísticas locked para plataforma ios', () => {
6
- assert.equal(iosRules.length, 83);
6
+ assert.equal(iosRules.length, 85);
7
7
 
8
8
  const ids = iosRules.map((rule) => rule.id);
9
9
  assert.deepEqual(ids, [
@@ -61,6 +61,8 @@ test('iosRules define reglas heurísticas locked para plataforma ios', () => {
61
61
  'heuristics.ios.font-weight-bold.ast',
62
62
  'heuristics.ios.swiftui.explicit-color-static-member.ast',
63
63
  'heuristics.ios.swiftui.closure-based-viewbuilder-content.ast',
64
+ 'heuristics.ios.swiftui.large-config-context-prop.ast',
65
+ 'heuristics.ios.swiftui.conditional-same-view-identity.ast',
64
66
  'heuristics.ios.swiftui.redundant-reactive-state-assignment.ast',
65
67
  'heuristics.ios.swiftui.non-lazy-scroll-foreach.ast',
66
68
  'heuristics.ios.swiftui.body-object-creation.ast',
@@ -205,6 +207,14 @@ test('iosRules define reglas heurísticas locked para plataforma ios', () => {
205
207
  byId.get('heuristics.ios.font-weight-bold.ast')?.then.code,
206
208
  'HEURISTICS_IOS_FONT_WEIGHT_BOLD_AST'
207
209
  );
210
+ assert.equal(
211
+ byId.get('heuristics.ios.swiftui.large-config-context-prop.ast')?.then.code,
212
+ 'HEURISTICS_IOS_SWIFTUI_LARGE_CONFIG_CONTEXT_PROP_AST'
213
+ );
214
+ assert.equal(
215
+ byId.get('heuristics.ios.swiftui.conditional-same-view-identity.ast')?.then.code,
216
+ 'HEURISTICS_IOS_SWIFTUI_CONDITIONAL_SAME_VIEW_IDENTITY_AST'
217
+ );
208
218
  assert.equal(
209
219
  byId.get('heuristics.ios.uiscreen-main-bounds.ast')?.then.code,
210
220
  'HEURISTICS_IOS_UISCREEN_MAIN_BOUNDS_AST'
@@ -989,6 +989,45 @@ export const iosRules: RuleSet = [
989
989
  code: 'HEURISTICS_IOS_SWIFTUI_CLOSURE_BASED_VIEWBUILDER_CONTENT_AST',
990
990
  },
991
991
  },
992
+ {
993
+ id: 'heuristics.ios.swiftui.large-config-context-prop.ast',
994
+ description: 'Detects broad Config/Context properties stored directly on SwiftUI Views.',
995
+ severity: 'WARN',
996
+ platform: 'ios',
997
+ locked: true,
998
+ when: {
999
+ kind: 'Heuristic',
1000
+ where: {
1001
+ ruleId: 'heuristics.ios.swiftui.large-config-context-prop.ast',
1002
+ },
1003
+ },
1004
+ then: {
1005
+ kind: 'Finding',
1006
+ message:
1007
+ 'AST heuristic detected a SwiftUI View storing a broad config/context object; pass only needed values to reduce update fan-out.',
1008
+ code: 'HEURISTICS_IOS_SWIFTUI_LARGE_CONFIG_CONTEXT_PROP_AST',
1009
+ },
1010
+ },
1011
+ {
1012
+ id: 'heuristics.ios.swiftui.conditional-same-view-identity.ast',
1013
+ description:
1014
+ 'Detects SwiftUI if/else branches that rebuild the same View type for state-only visual changes.',
1015
+ severity: 'WARN',
1016
+ platform: 'ios',
1017
+ locked: true,
1018
+ when: {
1019
+ kind: 'Heuristic',
1020
+ where: {
1021
+ ruleId: 'heuristics.ios.swiftui.conditional-same-view-identity.ast',
1022
+ },
1023
+ },
1024
+ then: {
1025
+ kind: 'Finding',
1026
+ message:
1027
+ 'AST heuristic detected conditional branches rebuilding the same SwiftUI View type; prefer conditional modifiers or values to preserve view identity.',
1028
+ code: 'HEURISTICS_IOS_SWIFTUI_CONDITIONAL_SAME_VIEW_IDENTITY_AST',
1029
+ },
1030
+ },
992
1031
  {
993
1032
  id: 'heuristics.ios.swiftui.redundant-reactive-state-assignment.ast',
994
1033
  description: 'Detects onChange/onReceive state assignments without a value-change guard.',
@@ -280,6 +280,14 @@ const registryByRuleId: Record<string, SkillsDetectorBinding> = {
280
280
  heuristicDetector('ios.swiftui.closure-based-viewbuilder-content', [
281
281
  'heuristics.ios.swiftui.closure-based-viewbuilder-content.ast',
282
282
  ]),
283
+ 'skills.ios.guideline.ios-swiftui-expert.pass-only-needed-values-to-views-avoid-large-config-or-context-objects':
284
+ heuristicDetector('ios.swiftui.large-config-context-prop', [
285
+ 'heuristics.ios.swiftui.large-config-context-prop.ast',
286
+ ]),
287
+ 'skills.ios.guideline.ios-swiftui-expert.prefer-modifiers-over-conditional-views-for-state-changes-maintains-vi':
288
+ heuristicDetector('ios.swiftui.conditional-same-view-identity', [
289
+ 'heuristics.ios.swiftui.conditional-same-view-identity.ast',
290
+ ]),
283
291
  'skills.ios.guideline.ios-swiftui-expert.avoid-redundant-state-updates-in-onreceive-onchange-scroll-handlers':
284
292
  heuristicDetector('ios.swiftui.redundant-reactive-state-assignment', [
285
293
  'heuristics.ios.swiftui.redundant-reactive-state-assignment.ast',
@@ -324,6 +324,12 @@ const normalizeKnownRuleTarget = (
324
324
  ) {
325
325
  return 'skills.ios.guideline.ios-swiftui-expert.use-relative-layout-over-hard-coded-constants';
326
326
  }
327
+ if (
328
+ (includes('prefer modifiers') || includes('modifiers over conditional views')) &&
329
+ (includes('conditional views') || includes('view identity') || includes('maintains view identity'))
330
+ ) {
331
+ return 'skills.ios.guideline.ios-swiftui-expert.prefer-modifiers-over-conditional-views-for-state-changes-maintains-vi';
332
+ }
327
333
  if (
328
334
  (includes('foreach') && includes('indices')) ||
329
335
  includes('stable identity for foreach') ||
@@ -393,6 +399,15 @@ const normalizeKnownRuleTarget = (
393
399
  ) {
394
400
  return 'skills.ios.guideline.ios-swiftui-expert.prefer-viewbuilder-let-content-content-over-closure-based-content-prop';
395
401
  }
402
+ if (
403
+ includes('pass only needed values') ||
404
+ includes('large config') ||
405
+ includes('large context') ||
406
+ includes('config or context objects') ||
407
+ includes('config/context objects')
408
+ ) {
409
+ return 'skills.ios.guideline.ios-swiftui-expert.pass-only-needed-values-to-views-avoid-large-config-or-context-objects';
410
+ }
396
411
  if (
397
412
  includes('redundant state updates') ||
398
413
  (includes('onreceive') && includes('onchange') && includes('state updates')) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki",
3
- "version": "6.3.244",
3
+ "version": "6.3.246",
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-14T07:29:57.101Z",
4
+ "generatedAt": "2026-05-14T07:54:39.127Z",
5
5
  "bundles": [
6
6
  {
7
7
  "name": "android-guidelines",
@@ -8620,7 +8620,7 @@
8620
8620
  "name": "ios-swiftui-expert-guidelines",
8621
8621
  "version": "1.0.0",
8622
8622
  "source": "file:vendor/skills/swiftui-expert-skill/SKILL.md",
8623
- "hash": "95d13f770dcf3a0ecb957e4cabcfd09c9d9b39a15421c8599c6fe5470d1c3f95",
8623
+ "hash": "3d5c272144d49aae587877dd2f8578409e26c0a6846ec43e267bc735a02e6cb0",
8624
8624
  "rules": [
8625
8625
  {
8626
8626
  "id": "skills.ios.guideline.ios-swiftui-expert.action-handlers-should-reference-methods-not-contain-inline-logic",
@@ -8715,7 +8715,7 @@
8715
8715
  "sourcePath": "vendor/skills/swiftui-expert-skill/SKILL.md",
8716
8716
  "confidence": "MEDIUM",
8717
8717
  "locked": true,
8718
- "evaluationMode": "DECLARATIVE",
8718
+ "evaluationMode": "AUTO",
8719
8719
  "origin": "core"
8720
8720
  },
8721
8721
  {
@@ -8727,7 +8727,7 @@
8727
8727
  "sourcePath": "vendor/skills/swiftui-expert-skill/SKILL.md",
8728
8728
  "confidence": "MEDIUM",
8729
8729
  "locked": true,
8730
- "evaluationMode": "DECLARATIVE",
8730
+ "evaluationMode": "AUTO",
8731
8731
  "origin": "core"
8732
8732
  },
8733
8733
  {