pumuki 6.3.245 → 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,12 @@ 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
+
9
15
  ## [6.3.245] - 2026-05-14
10
16
 
11
17
  ### Added
@@ -74,6 +74,7 @@ import {
74
74
  hasSwiftExplicitColorStaticMemberUsage,
75
75
  hasSwiftClosureBasedViewBuilderContentUsage,
76
76
  hasSwiftLargeConfigContextViewPropertyUsage,
77
+ hasSwiftUiConditionalSameViewIdentityUsage,
77
78
  hasSwiftRedundantReactiveStateAssignmentUsage,
78
79
  hasSwiftInlineForEachTransformUsage,
79
80
  hasSwiftStringFormatUsage,
@@ -2071,3 +2072,43 @@ final class PumukiLspIosCanaryPremiumDiscount: PumukiLspIosCanaryDiscountApplyin
2071
2072
  assert.match(match.impact, /sustitución|precondiciones|regresiones/i);
2072
2073
  assert.match(match.expected_fix, /contrato base|adaptador|estrategia/i);
2073
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
+ });
@@ -981,6 +981,44 @@ export const hasSwiftLargeConfigContextViewPropertyUsage = (source: string): boo
981
981
  return false;
982
982
  };
983
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
+
984
1022
  export const hasSwiftRedundantReactiveStateAssignmentUsage = (source: string): boolean => {
985
1023
  const sanitized = sanitizeSwiftSourceForMultilineRegex(source);
986
1024
  const reactiveAssignmentPattern =
@@ -690,6 +690,7 @@ const textDetectorRegistry: ReadonlyArray<TextDetectorRegistryEntry> = [
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
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.' },
693
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.' },
694
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.' },
695
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, 84);
6
+ assert.equal(iosRules.length, 85);
7
7
 
8
8
  const ids = iosRules.map((rule) => rule.id);
9
9
  assert.deepEqual(ids, [
@@ -62,6 +62,7 @@ test('iosRules define reglas heurísticas locked para plataforma ios', () => {
62
62
  'heuristics.ios.swiftui.explicit-color-static-member.ast',
63
63
  'heuristics.ios.swiftui.closure-based-viewbuilder-content.ast',
64
64
  'heuristics.ios.swiftui.large-config-context-prop.ast',
65
+ 'heuristics.ios.swiftui.conditional-same-view-identity.ast',
65
66
  'heuristics.ios.swiftui.redundant-reactive-state-assignment.ast',
66
67
  'heuristics.ios.swiftui.non-lazy-scroll-foreach.ast',
67
68
  'heuristics.ios.swiftui.body-object-creation.ast',
@@ -210,6 +211,10 @@ test('iosRules define reglas heurísticas locked para plataforma ios', () => {
210
211
  byId.get('heuristics.ios.swiftui.large-config-context-prop.ast')?.then.code,
211
212
  'HEURISTICS_IOS_SWIFTUI_LARGE_CONFIG_CONTEXT_PROP_AST'
212
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
+ );
213
218
  assert.equal(
214
219
  byId.get('heuristics.ios.uiscreen-main-bounds.ast')?.then.code,
215
220
  'HEURISTICS_IOS_UISCREEN_MAIN_BOUNDS_AST'
@@ -1008,6 +1008,26 @@ export const iosRules: RuleSet = [
1008
1008
  code: 'HEURISTICS_IOS_SWIFTUI_LARGE_CONFIG_CONTEXT_PROP_AST',
1009
1009
  },
1010
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
+ },
1011
1031
  {
1012
1032
  id: 'heuristics.ios.swiftui.redundant-reactive-state-assignment.ast',
1013
1033
  description: 'Detects onChange/onReceive state assignments without a value-change guard.',
@@ -284,6 +284,10 @@ const registryByRuleId: Record<string, SkillsDetectorBinding> = {
284
284
  heuristicDetector('ios.swiftui.large-config-context-prop', [
285
285
  'heuristics.ios.swiftui.large-config-context-prop.ast',
286
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
+ ]),
287
291
  'skills.ios.guideline.ios-swiftui-expert.avoid-redundant-state-updates-in-onreceive-onchange-scroll-handlers':
288
292
  heuristicDetector('ios.swiftui.redundant-reactive-state-assignment', [
289
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') ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki",
3
- "version": "6.3.245",
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:45:13.168Z",
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": "0c30a1be4bf60d113d15b12da5fdea1f49c5dc64cda8bbb8c3b9885dcfe5abcb",
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",
@@ -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
  {