pumuki 6.3.245 → 6.3.247

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.247] - 2026-05-14
10
+
11
+ ### Added
12
+
13
+ - **SwiftUI sheet action parity:** `skills.ios.guideline.ios-swiftui-expert.sheets-should-own-their-actions-and-call-dismiss-internally` now maps to a scoped AUTO heuristic that detects sheet content receiving parent-owned save/cancel/dismiss callbacks, preserving sheets that own their actions internally.
14
+
15
+ ## [6.3.246] - 2026-05-14
16
+
17
+ ### Added
18
+
19
+ - **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.
20
+
9
21
  ## [6.3.245] - 2026-05-14
10
22
 
11
23
  ### Added
@@ -74,6 +74,8 @@ import {
74
74
  hasSwiftExplicitColorStaticMemberUsage,
75
75
  hasSwiftClosureBasedViewBuilderContentUsage,
76
76
  hasSwiftLargeConfigContextViewPropertyUsage,
77
+ hasSwiftUiConditionalSameViewIdentityUsage,
78
+ hasSwiftUiParentOwnedSheetActionUsage,
77
79
  hasSwiftRedundantReactiveStateAssignmentUsage,
78
80
  hasSwiftInlineForEachTransformUsage,
79
81
  hasSwiftStringFormatUsage,
@@ -2071,3 +2073,103 @@ final class PumukiLspIosCanaryPremiumDiscount: PumukiLspIosCanaryDiscountApplyin
2071
2073
  assert.match(match.impact, /sustitución|precondiciones|regresiones/i);
2072
2074
  assert.match(match.expected_fix, /contrato base|adaptador|estrategia/i);
2073
2075
  });
2076
+
2077
+ test('hasSwiftUiConditionalSameViewIdentityUsage detecta ramas que reconstruyen la misma View por estado visual', () => {
2078
+ const source = `
2079
+ struct StatusBadge: View {
2080
+ let isSelected: Bool
2081
+
2082
+ var body: some View {
2083
+ if isSelected {
2084
+ Text("Active")
2085
+ .foregroundStyle(.green)
2086
+ } else {
2087
+ Text("Active")
2088
+ .foregroundStyle(.secondary)
2089
+ }
2090
+ }
2091
+ }
2092
+ `;
2093
+ const safe = `
2094
+ struct StatusBadge: View {
2095
+ let isSelected: Bool
2096
+
2097
+ var body: some View {
2098
+ Text("Active")
2099
+ .foregroundStyle(isSelected ? .green : .secondary)
2100
+
2101
+ if isSelected {
2102
+ SuccessBadge()
2103
+ } else {
2104
+ EmptyView()
2105
+ }
2106
+
2107
+ let sample = "if isSelected { Text(\"Active\") } else { Text(\"Active\") }"
2108
+ // if isSelected { Text("Active") } else { Text("Active") }
2109
+ }
2110
+ }
2111
+ `;
2112
+
2113
+ assert.equal(hasSwiftUiConditionalSameViewIdentityUsage(source), true);
2114
+ assert.equal(hasSwiftUiConditionalSameViewIdentityUsage(safe), false);
2115
+ });
2116
+
2117
+ test('hasSwiftUiParentOwnedSheetActionUsage detecta sheets que reciben callbacks de accion del padre', () => {
2118
+ const source = `
2119
+ struct ParentView: View {
2120
+ @State private var selectedItem: Item?
2121
+
2122
+ var body: some View {
2123
+ List(items) { item in
2124
+ Button(item.name) {
2125
+ selectedItem = item
2126
+ }
2127
+ }
2128
+ .sheet(item: $selectedItem) { item in
2129
+ EditItemSheet(
2130
+ item: item,
2131
+ onSave: { newName in
2132
+ save(item, newName)
2133
+ },
2134
+ onCancel: {
2135
+ selectedItem = nil
2136
+ }
2137
+ )
2138
+ }
2139
+ }
2140
+ }
2141
+ `;
2142
+ const safe = `
2143
+ struct ParentView: View {
2144
+ @State private var selectedItem: Item?
2145
+
2146
+ var body: some View {
2147
+ List(items) { item in
2148
+ Button(item.name) {
2149
+ selectedItem = item
2150
+ }
2151
+ }
2152
+ .sheet(item: $selectedItem) { item in
2153
+ EditItemSheet(item: item)
2154
+ }
2155
+
2156
+ let sample = ".sheet(item: $selectedItem) { EditItemSheet(onCancel: {}) }"
2157
+ // .sheet(item: $selectedItem) { EditItemSheet(onSave: {}) }
2158
+ }
2159
+ }
2160
+
2161
+ struct EditItemSheet: View {
2162
+ @Environment(\\.dismiss) private var dismiss
2163
+ let item: Item
2164
+
2165
+ var body: some View {
2166
+ Button("Cancel") {
2167
+ dismiss()
2168
+ }
2169
+ }
2170
+ }
2171
+ `;
2172
+
2173
+ assert.equal(hasSwiftUiParentOwnedSheetActionUsage(source), true);
2174
+ assert.equal(hasSwiftUiParentOwnedSheetActionUsage(safe), false);
2175
+ });
@@ -981,6 +981,59 @@ 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
+
1022
+ export const hasSwiftUiParentOwnedSheetActionUsage = (source: string): boolean => {
1023
+ const sanitized = sanitizeSwiftSourceForMultilineRegex(source);
1024
+ const swiftUIViewBodyPattern =
1025
+ /\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;
1026
+
1027
+ if (!swiftUIViewBodyPattern.test(sanitized)) {
1028
+ return false;
1029
+ }
1030
+
1031
+ const sheetWithCallbackPattern =
1032
+ /\.(?:sheet|fullScreenCover)\s*\([^)]*\)\s*\{[\s\S]{0,1200}?\b[A-Za-z_][A-Za-z0-9_]*\s*\([\s\S]{0,900}?\b(?:onSave|onCancel|onDismiss|onClose|onDone|onDelete|onConfirm)\s*:\s*\{/g;
1033
+
1034
+ return sheetWithCallbackPattern.test(sanitized);
1035
+ };
1036
+
984
1037
  export const hasSwiftRedundantReactiveStateAssignmentUsage = (source: string): boolean => {
985
1038
  const sanitized = sanitizeSwiftSourceForMultilineRegex(source);
986
1039
  const reactiveAssignmentPattern =
@@ -690,6 +690,8 @@ 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.' },
694
+ { platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftUiParentOwnedSheetActionUsage, ruleId: 'heuristics.ios.swiftui.parent-owned-sheet-action.ast', code: 'HEURISTICS_IOS_SWIFTUI_PARENT_OWNED_SHEET_ACTION_AST', message: 'AST heuristic detected a SwiftUI sheet receiving parent-owned action callbacks; sheets should own save/cancel actions and call dismiss() internally.' },
693
695
  { 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
696
  { 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
697
  { 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, 86);
7
7
 
8
8
  const ids = iosRules.map((rule) => rule.id);
9
9
  assert.deepEqual(ids, [
@@ -62,6 +62,8 @@ 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',
66
+ 'heuristics.ios.swiftui.parent-owned-sheet-action.ast',
65
67
  'heuristics.ios.swiftui.redundant-reactive-state-assignment.ast',
66
68
  'heuristics.ios.swiftui.non-lazy-scroll-foreach.ast',
67
69
  'heuristics.ios.swiftui.body-object-creation.ast',
@@ -210,6 +212,14 @@ test('iosRules define reglas heurísticas locked para plataforma ios', () => {
210
212
  byId.get('heuristics.ios.swiftui.large-config-context-prop.ast')?.then.code,
211
213
  'HEURISTICS_IOS_SWIFTUI_LARGE_CONFIG_CONTEXT_PROP_AST'
212
214
  );
215
+ assert.equal(
216
+ byId.get('heuristics.ios.swiftui.conditional-same-view-identity.ast')?.then.code,
217
+ 'HEURISTICS_IOS_SWIFTUI_CONDITIONAL_SAME_VIEW_IDENTITY_AST'
218
+ );
219
+ assert.equal(
220
+ byId.get('heuristics.ios.swiftui.parent-owned-sheet-action.ast')?.then.code,
221
+ 'HEURISTICS_IOS_SWIFTUI_PARENT_OWNED_SHEET_ACTION_AST'
222
+ );
213
223
  assert.equal(
214
224
  byId.get('heuristics.ios.uiscreen-main-bounds.ast')?.then.code,
215
225
  'HEURISTICS_IOS_UISCREEN_MAIN_BOUNDS_AST'
@@ -1008,6 +1008,46 @@ 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
+ },
1031
+ {
1032
+ id: 'heuristics.ios.swiftui.parent-owned-sheet-action.ast',
1033
+ description:
1034
+ 'Detects SwiftUI sheets that receive save/cancel/dismiss callbacks from the parent view.',
1035
+ severity: 'WARN',
1036
+ platform: 'ios',
1037
+ locked: true,
1038
+ when: {
1039
+ kind: 'Heuristic',
1040
+ where: {
1041
+ ruleId: 'heuristics.ios.swiftui.parent-owned-sheet-action.ast',
1042
+ },
1043
+ },
1044
+ then: {
1045
+ kind: 'Finding',
1046
+ message:
1047
+ 'AST heuristic detected a SwiftUI sheet receiving parent-owned action callbacks; sheets should own save/cancel actions and call dismiss() internally.',
1048
+ code: 'HEURISTICS_IOS_SWIFTUI_PARENT_OWNED_SHEET_ACTION_AST',
1049
+ },
1050
+ },
1011
1051
  {
1012
1052
  id: 'heuristics.ios.swiftui.redundant-reactive-state-assignment.ast',
1013
1053
  description: 'Detects onChange/onReceive state assignments without a value-change guard.',
@@ -284,6 +284,14 @@ 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
+ ]),
291
+ 'skills.ios.guideline.ios-swiftui-expert.sheets-should-own-their-actions-and-call-dismiss-internally':
292
+ heuristicDetector('ios.swiftui.parent-owned-sheet-action', [
293
+ 'heuristics.ios.swiftui.parent-owned-sheet-action.ast',
294
+ ]),
287
295
  'skills.ios.guideline.ios-swiftui-expert.avoid-redundant-state-updates-in-onreceive-onchange-scroll-handlers':
288
296
  heuristicDetector('ios.swiftui.redundant-reactive-state-assignment', [
289
297
  'heuristics.ios.swiftui.redundant-reactive-state-assignment.ast',
@@ -324,6 +324,19 @@ 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
+ }
333
+ if (
334
+ includes('sheets should own their actions') ||
335
+ (includes('call dismiss internally') && includes('sheet')) ||
336
+ (includes('avoid passing dismiss') && includes('callbacks to sheets'))
337
+ ) {
338
+ return 'skills.ios.guideline.ios-swiftui-expert.sheets-should-own-their-actions-and-call-dismiss-internally';
339
+ }
327
340
  if (
328
341
  (includes('foreach') && includes('indices')) ||
329
342
  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.247",
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-14T08:03:51.620Z",
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": "5a759b80ddf1308e23cd04aef7e1628abf13dcd0e9d7649039da10a40f1de860",
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
  {
@@ -8775,7 +8775,7 @@
8775
8775
  "sourcePath": "vendor/skills/swiftui-expert-skill/SKILL.md",
8776
8776
  "confidence": "MEDIUM",
8777
8777
  "locked": true,
8778
- "evaluationMode": "DECLARATIVE",
8778
+ "evaluationMode": "AUTO",
8779
8779
  "origin": "core"
8780
8780
  },
8781
8781
  {