@mmerterden/multi-agent-pipeline 20.6.0 → 20.8.0

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.
Files changed (326) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +0 -10
  3. package/docs/facts.json +1 -1
  4. package/manifest.json +328 -329
  5. package/package.json +2 -2
  6. package/pipeline/multi-agent-refs/features/design-conformance.md +62 -64
  7. package/pipeline/scripts/_notices.mjs +12 -1
  8. package/pipeline/scripts/gen-skills-index.mjs +1 -1
  9. package/pipeline/skills/.skill-manifest.json +106 -106
  10. package/pipeline/skills/shared/README.md +71 -71
  11. package/pipeline/skills/shared/external/agent-introspection-debugging/SKILL.md +1 -0
  12. package/pipeline/skills/shared/external/alarmkit/SKILL.md +373 -381
  13. package/pipeline/skills/shared/external/alarmkit/evals/evals.json +23 -18
  14. package/pipeline/skills/shared/external/alarmkit/references/alarmkit-patterns.md +328 -378
  15. package/pipeline/skills/shared/external/android-architecture/SKILL.md +2 -0
  16. package/pipeline/skills/shared/external/android-performance/SKILL.md +2 -0
  17. package/pipeline/skills/shared/external/android-security/SKILL.md +2 -0
  18. package/pipeline/skills/shared/external/app-clips/SKILL.md +260 -160
  19. package/pipeline/skills/shared/external/app-clips/evals/evals.json +27 -27
  20. package/pipeline/skills/shared/external/app-clips/references/data-handoff-notifications-location.md +150 -83
  21. package/pipeline/skills/shared/external/app-clips/references/routing-and-experiences.md +135 -83
  22. package/pipeline/skills/shared/external/app-clips/references/size-capabilities-and-promotion.md +143 -85
  23. package/pipeline/skills/shared/external/app-intents/SKILL.md +302 -304
  24. package/pipeline/skills/shared/external/app-intents/evals/evals.json +21 -21
  25. package/pipeline/skills/shared/external/app-intents/references/appintents-advanced.md +594 -894
  26. package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +339 -277
  27. package/pipeline/skills/shared/external/app-store-optimization/evals/evals.json +27 -23
  28. package/pipeline/skills/shared/external/app-store-optimization/references/keyword-research-methodology.md +105 -122
  29. package/pipeline/skills/shared/external/app-store-optimization/references/product-page-variants.md +143 -166
  30. package/pipeline/skills/shared/external/app-store-review/SKILL.md +307 -326
  31. package/pipeline/skills/shared/external/app-store-review/evals/evals.json +21 -21
  32. package/pipeline/skills/shared/external/app-store-review/references/privacy-manifest.md +105 -67
  33. package/pipeline/skills/shared/external/app-store-review/references/review-checklists.md +114 -101
  34. package/pipeline/skills/shared/external/apple-on-device-ai/SKILL.md +333 -360
  35. package/pipeline/skills/shared/external/apple-on-device-ai/evals/evals.json +24 -27
  36. package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-conversion.md +215 -322
  37. package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-optimization.md +161 -256
  38. package/pipeline/skills/shared/external/apple-on-device-ai/references/foundation-models.md +277 -387
  39. package/pipeline/skills/shared/external/apple-on-device-ai/references/mlx-swift.md +196 -210
  40. package/pipeline/skills/shared/external/authentication/SKILL.md +265 -381
  41. package/pipeline/skills/shared/external/authentication/evals/evals.json +25 -25
  42. package/pipeline/skills/shared/external/authentication/references/keychain-biometric.md +133 -178
  43. package/pipeline/skills/shared/external/authentication/references/passkeys.md +111 -147
  44. package/pipeline/skills/shared/external/avkit/SKILL.md +267 -364
  45. package/pipeline/skills/shared/external/avkit/evals/evals.json +26 -26
  46. package/pipeline/skills/shared/external/avkit/references/avkit-patterns.md +375 -493
  47. package/pipeline/skills/shared/external/background-processing/SKILL.md +270 -382
  48. package/pipeline/skills/shared/external/background-processing/evals/evals.json +22 -22
  49. package/pipeline/skills/shared/external/background-processing/references/background-task-patterns.md +169 -317
  50. package/pipeline/skills/shared/external/backlog/BACKLOG.md +1 -1
  51. package/pipeline/skills/shared/external/backlog/SKILL.md +56 -33
  52. package/pipeline/skills/shared/external/callkit-voip/SKILL.md +290 -371
  53. package/pipeline/skills/shared/external/callkit-voip/evals/evals.json +24 -24
  54. package/pipeline/skills/shared/external/callkit-voip/references/callkit-patterns.md +175 -343
  55. package/pipeline/skills/shared/external/ci-cd-pipelines/SKILL.md +1 -0
  56. package/pipeline/skills/shared/external/cloudkit-sync/SKILL.md +292 -381
  57. package/pipeline/skills/shared/external/cloudkit-sync/evals/evals.json +33 -30
  58. package/pipeline/skills/shared/external/cloudkit-sync/references/cloudkit-patterns.md +227 -355
  59. package/pipeline/skills/shared/external/compose-components/SKILL.md +2 -0
  60. package/pipeline/skills/shared/external/compose-navigation/SKILL.md +3 -2
  61. package/pipeline/skills/shared/external/compose-testing/SKILL.md +2 -0
  62. package/pipeline/skills/shared/external/contacts-framework/SKILL.md +197 -346
  63. package/pipeline/skills/shared/external/contacts-framework/evals/evals.json +19 -21
  64. package/pipeline/skills/shared/external/contacts-framework/references/contacts-patterns.md +169 -308
  65. package/pipeline/skills/shared/external/core-bluetooth/SKILL.md +226 -376
  66. package/pipeline/skills/shared/external/core-bluetooth/evals/evals.json +25 -22
  67. package/pipeline/skills/shared/external/core-bluetooth/references/ble-patterns.md +257 -337
  68. package/pipeline/skills/shared/external/core-data/SKILL.md +292 -368
  69. package/pipeline/skills/shared/external/core-data/evals/evals.json +30 -27
  70. package/pipeline/skills/shared/external/core-motion/SKILL.md +235 -324
  71. package/pipeline/skills/shared/external/core-motion/evals/evals.json +31 -27
  72. package/pipeline/skills/shared/external/core-motion/references/motion-patterns.md +210 -310
  73. package/pipeline/skills/shared/external/core-nfc/SKILL.md +292 -366
  74. package/pipeline/skills/shared/external/core-nfc/evals/evals.json +22 -24
  75. package/pipeline/skills/shared/external/core-nfc/references/nfc-patterns.md +233 -329
  76. package/pipeline/skills/shared/external/coreml/SKILL.md +323 -367
  77. package/pipeline/skills/shared/external/coreml/evals/evals.json +24 -21
  78. package/pipeline/skills/shared/external/coreml/references/coreml-swift-integration.md +562 -565
  79. package/pipeline/skills/shared/external/council/SKILL.md +1 -0
  80. package/pipeline/skills/shared/external/cryptokit/SKILL.md +253 -394
  81. package/pipeline/skills/shared/external/cryptokit/evals/evals.json +20 -18
  82. package/pipeline/skills/shared/external/cryptokit/references/cryptokit-patterns.md +299 -488
  83. package/pipeline/skills/shared/external/css-modern/SKILL.md +1 -0
  84. package/pipeline/skills/shared/external/database-patterns/SKILL.md +1 -0
  85. package/pipeline/skills/shared/external/debugging-instruments/SKILL.md +270 -323
  86. package/pipeline/skills/shared/external/debugging-instruments/evals/evals.json +27 -30
  87. package/pipeline/skills/shared/external/debugging-instruments/references/instruments-guide.md +167 -315
  88. package/pipeline/skills/shared/external/debugging-instruments/references/lldb-patterns.md +140 -193
  89. package/pipeline/skills/shared/external/device-integrity/SKILL.md +230 -353
  90. package/pipeline/skills/shared/external/device-integrity/evals/evals.json +25 -21
  91. package/pipeline/skills/shared/external/device-integrity/references/device-integrity-patterns.md +159 -197
  92. package/pipeline/skills/shared/external/energykit/SKILL.md +225 -392
  93. package/pipeline/skills/shared/external/energykit/evals/evals.json +29 -28
  94. package/pipeline/skills/shared/external/energykit/references/energykit-patterns.md +174 -470
  95. package/pipeline/skills/shared/external/eventkit-calendar/SKILL.md +261 -383
  96. package/pipeline/skills/shared/external/eventkit-calendar/evals/evals.json +25 -22
  97. package/pipeline/skills/shared/external/eventkit-calendar/references/eventkit-patterns.md +165 -268
  98. package/pipeline/skills/shared/external/evidence-github/SKILL.md +2 -0
  99. package/pipeline/skills/shared/external/evidence-registry/SKILL.md +2 -0
  100. package/pipeline/skills/shared/external/gradle-kotlin-dsl/SKILL.md +2 -0
  101. package/pipeline/skills/shared/external/healthkit/SKILL.md +252 -303
  102. package/pipeline/skills/shared/external/healthkit/evals/evals.json +24 -23
  103. package/pipeline/skills/shared/external/healthkit/references/healthkit-patterns.md +369 -523
  104. package/pipeline/skills/shared/external/homekit-matter/SKILL.md +233 -348
  105. package/pipeline/skills/shared/external/homekit-matter/evals/evals.json +27 -22
  106. package/pipeline/skills/shared/external/homekit-matter/references/matter-commissioning.md +199 -305
  107. package/pipeline/skills/shared/external/html-semantic/SKILL.md +1 -0
  108. package/pipeline/skills/shared/external/humanizer/SKILL.md +1 -0
  109. package/pipeline/skills/shared/external/ios-accessibility/SKILL.md +368 -340
  110. package/pipeline/skills/shared/external/ios-accessibility/evals/evals.json +28 -27
  111. package/pipeline/skills/shared/external/ios-accessibility/references/a11y-patterns.md +314 -260
  112. package/pipeline/skills/shared/external/ios-accessibility/references/media-accessibility.md +97 -67
  113. package/pipeline/skills/shared/external/ios-accessibility/references/nutrition-labels.md +165 -101
  114. package/pipeline/skills/shared/external/ios-coding-standard/SKILL.md +1 -0
  115. package/pipeline/skills/shared/external/ios-localization/SKILL.md +258 -371
  116. package/pipeline/skills/shared/external/ios-localization/evals/evals.json +23 -23
  117. package/pipeline/skills/shared/external/ios-localization/references/formatstyle-locale.md +283 -491
  118. package/pipeline/skills/shared/external/ios-localization/references/string-catalogs.md +313 -440
  119. package/pipeline/skills/shared/external/ios-module-structure/SKILL.md +1 -0
  120. package/pipeline/skills/shared/external/ios-networking/SKILL.md +265 -341
  121. package/pipeline/skills/shared/external/ios-networking/evals/evals.json +24 -24
  122. package/pipeline/skills/shared/external/ios-networking/references/background-websocket.md +425 -652
  123. package/pipeline/skills/shared/external/ios-networking/references/file-storage-patterns.md +143 -285
  124. package/pipeline/skills/shared/external/ios-networking/references/lightweight-clients.md +93 -53
  125. package/pipeline/skills/shared/external/ios-networking/references/network-framework.md +231 -456
  126. package/pipeline/skills/shared/external/ios-networking/references/urlsession-patterns.md +517 -784
  127. package/pipeline/skills/shared/external/ios-security/SKILL.md +2 -0
  128. package/pipeline/skills/shared/external/ios-simulator/SKILL.md +265 -393
  129. package/pipeline/skills/shared/external/ios-simulator/evals/evals.json +21 -21
  130. package/pipeline/skills/shared/external/ios-simulator/references/simctl-commands.md +177 -270
  131. package/pipeline/skills/shared/external/live-activities/SKILL.md +318 -360
  132. package/pipeline/skills/shared/external/live-activities/evals/evals.json +21 -21
  133. package/pipeline/skills/shared/external/live-activities/references/activitykit-patterns.md +478 -710
  134. package/pipeline/skills/shared/external/localization-reuse-map/SKILL.md +91 -283
  135. package/pipeline/skills/shared/external/localization-reuse-map/reference/format-and-output.md +119 -151
  136. package/pipeline/skills/shared/external/localization-reuse-map/reference/publish-and-snapshot.md +60 -90
  137. package/pipeline/skills/shared/external/localization-reuse-map/reference/sources-and-recipes.md +119 -156
  138. package/pipeline/skills/shared/external/localization-reuse-map/scripts/build-artifact.py +726 -787
  139. package/pipeline/skills/shared/external/localization-reuse-map/scripts/build-spreadsheet.py +253 -288
  140. package/pipeline/skills/shared/external/localization-reuse-map/scripts/fetch-annotations.py +243 -304
  141. package/pipeline/skills/shared/external/localization-reuse-map/scripts/fetch-legacy-labels.py +88 -104
  142. package/pipeline/skills/shared/external/localization-reuse-map/scripts/publish-confluence.py +181 -235
  143. package/pipeline/skills/shared/external/localization-reuse-map/scripts/render-key-shots.py +198 -263
  144. package/pipeline/skills/shared/external/localization-reuse-map/scripts/render-overlay.py +461 -466
  145. package/pipeline/skills/shared/external/localization-reuse-map/scripts/resolve-legacy-values.py +145 -151
  146. package/pipeline/skills/shared/external/localization-reuse-map/scripts/resolve-new-values.py +123 -141
  147. package/pipeline/skills/shared/external/localization-reuse-map/scripts/scan-screen-keys.py +146 -157
  148. package/pipeline/skills/shared/external/localization-reuse-map/scripts/snapshot-resources.sh +22 -19
  149. package/pipeline/skills/shared/external/localization-reuse-map/scripts/verify-map.py +156 -140
  150. package/pipeline/skills/shared/external/mapkit-location/SKILL.md +295 -267
  151. package/pipeline/skills/shared/external/mapkit-location/evals/evals.json +28 -24
  152. package/pipeline/skills/shared/external/mapkit-location/references/mapkit-corelocation-patterns.md +378 -532
  153. package/pipeline/skills/shared/external/mapkit-location/references/mapkit-patterns.md +397 -499
  154. package/pipeline/skills/shared/external/metrickit-diagnostics/SKILL.md +165 -348
  155. package/pipeline/skills/shared/external/metrickit-diagnostics/evals/evals.json +26 -23
  156. package/pipeline/skills/shared/external/metrickit-diagnostics/references/metrickit-patterns.md +123 -130
  157. package/pipeline/skills/shared/external/musickit-audio/SKILL.md +189 -315
  158. package/pipeline/skills/shared/external/musickit-audio/evals/evals.json +22 -21
  159. package/pipeline/skills/shared/external/musickit-audio/references/musickit-patterns.md +181 -270
  160. package/pipeline/skills/shared/external/natural-language/SKILL.md +188 -340
  161. package/pipeline/skills/shared/external/natural-language/evals/evals.json +21 -21
  162. package/pipeline/skills/shared/external/natural-language/references/translation-patterns.md +171 -225
  163. package/pipeline/skills/shared/external/nextjs-app-router/SKILL.md +1 -0
  164. package/pipeline/skills/shared/external/passkit-wallet/SKILL.md +258 -392
  165. package/pipeline/skills/shared/external/passkit-wallet/evals/evals.json +30 -29
  166. package/pipeline/skills/shared/external/passkit-wallet/references/wallet-passes.md +164 -231
  167. package/pipeline/skills/shared/external/pdfkit/SKILL.md +312 -344
  168. package/pipeline/skills/shared/external/pdfkit/evals/evals.json +19 -19
  169. package/pipeline/skills/shared/external/pdfkit/references/pdfkit-patterns.md +413 -624
  170. package/pipeline/skills/shared/external/pencilkit-drawing/SKILL.md +242 -358
  171. package/pipeline/skills/shared/external/pencilkit-drawing/evals/evals.json +25 -21
  172. package/pipeline/skills/shared/external/pencilkit-drawing/references/pencilkit-patterns.md +161 -226
  173. package/pipeline/skills/shared/external/permissionkit/SKILL.md +282 -400
  174. package/pipeline/skills/shared/external/permissionkit/evals/evals.json +27 -30
  175. package/pipeline/skills/shared/external/permissionkit/references/permissionkit-patterns.md +237 -350
  176. package/pipeline/skills/shared/external/photos-camera-media/SKILL.md +276 -325
  177. package/pipeline/skills/shared/external/photos-camera-media/references/av-playback.md +299 -545
  178. package/pipeline/skills/shared/external/photos-camera-media/references/camera-capture.md +344 -588
  179. package/pipeline/skills/shared/external/photos-camera-media/references/image-loading-caching.md +316 -660
  180. package/pipeline/skills/shared/external/photos-camera-media/references/photokit-patterns.md +270 -416
  181. package/pipeline/skills/shared/external/play-store-review/SKILL.md +2 -0
  182. package/pipeline/skills/shared/external/push-notifications/SKILL.md +312 -340
  183. package/pipeline/skills/shared/external/push-notifications/evals/evals.json +27 -26
  184. package/pipeline/skills/shared/external/push-notifications/references/notification-patterns.md +328 -485
  185. package/pipeline/skills/shared/external/push-notifications/references/rich-notifications.md +327 -560
  186. package/pipeline/skills/shared/external/python-patterns/SKILL.md +1 -0
  187. package/pipeline/skills/shared/external/react-best-practices/SKILL.md +1 -0
  188. package/pipeline/skills/shared/external/realitykit-ar/SKILL.md +218 -410
  189. package/pipeline/skills/shared/external/realitykit-ar/evals/evals.json +24 -27
  190. package/pipeline/skills/shared/external/realitykit-ar/references/realitykit-patterns.md +221 -348
  191. package/pipeline/skills/shared/external/rest-api-design/SKILL.md +1 -0
  192. package/pipeline/skills/shared/external/retrofit-networking/SKILL.md +2 -0
  193. package/pipeline/skills/shared/external/room-database/SKILL.md +2 -0
  194. package/pipeline/skills/shared/external/search-first/SKILL.md +1 -0
  195. package/pipeline/skills/shared/external/shareplay-activities/SKILL.md +222 -393
  196. package/pipeline/skills/shared/external/shareplay-activities/evals/evals.json +23 -24
  197. package/pipeline/skills/shared/external/shareplay-activities/references/shareplay-patterns.md +280 -420
  198. package/pipeline/skills/shared/external/signal-community/SKILL.md +2 -0
  199. package/pipeline/skills/shared/external/skill-creator/SKILL.md +80 -41
  200. package/pipeline/skills/shared/external/skill-creator/audit.md +63 -59
  201. package/pipeline/skills/shared/external/skill-creator/checklist.md +28 -20
  202. package/pipeline/skills/shared/external/skill-creator/examples.md +40 -40
  203. package/pipeline/skills/shared/external/skill-creator/label-check.md +48 -36
  204. package/pipeline/skills/shared/external/skill-creator/scripts/audit-panel.js +91 -100
  205. package/pipeline/skills/shared/external/skill-creator/template.md +51 -39
  206. package/pipeline/skills/shared/external/speech-recognition/SKILL.md +217 -421
  207. package/pipeline/skills/shared/external/speech-recognition/evals/evals.json +23 -26
  208. package/pipeline/skills/shared/external/speech-recognition/references/speechanalyzer-patterns.md +133 -125
  209. package/pipeline/skills/shared/external/storekit/SKILL.md +228 -204
  210. package/pipeline/skills/shared/external/storekit/evals/evals.json +27 -24
  211. package/pipeline/skills/shared/external/storekit/references/app-review-guidelines.md +98 -109
  212. package/pipeline/skills/shared/external/storekit/references/core-patterns.md +298 -242
  213. package/pipeline/skills/shared/external/storekit/references/storekit-advanced.md +356 -649
  214. package/pipeline/skills/shared/external/swift-api-design-guidelines/SKILL.md +274 -399
  215. package/pipeline/skills/shared/external/swift-api-design-guidelines/evals/evals.json +22 -24
  216. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/argument-labels-and-parameters.md +107 -108
  217. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/conventions-and-special-rules.md +93 -165
  218. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/naming-and-clarity.md +99 -137
  219. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/side-effects-and-mutating-pairs.md +77 -120
  220. package/pipeline/skills/shared/external/swift-architecture/SKILL.md +334 -350
  221. package/pipeline/skills/shared/external/swift-architecture/evals/evals.json +22 -22
  222. package/pipeline/skills/shared/external/swift-charts/SKILL.md +208 -394
  223. package/pipeline/skills/shared/external/swift-charts/evals/evals.json +27 -30
  224. package/pipeline/skills/shared/external/swift-charts/references/charts-patterns.md +351 -762
  225. package/pipeline/skills/shared/external/swift-codable/SKILL.md +339 -343
  226. package/pipeline/skills/shared/external/swift-codable/evals/evals.json +20 -20
  227. package/pipeline/skills/shared/external/swift-concurrency/SKILL.md +303 -351
  228. package/pipeline/skills/shared/external/swift-concurrency/evals/evals.json +27 -24
  229. package/pipeline/skills/shared/external/swift-concurrency/references/approachable-concurrency.md +65 -80
  230. package/pipeline/skills/shared/external/swift-concurrency/references/async-algorithms.md +48 -84
  231. package/pipeline/skills/shared/external/swift-concurrency/references/bridging-interop.md +134 -79
  232. package/pipeline/skills/shared/external/swift-concurrency/references/concurrency-patterns.md +145 -167
  233. package/pipeline/skills/shared/external/swift-concurrency/references/diagnostics.md +62 -50
  234. package/pipeline/skills/shared/external/swift-concurrency/references/swiftui-concurrency.md +92 -121
  235. package/pipeline/skills/shared/external/swift-concurrency/references/synchronization-primitives.md +177 -241
  236. package/pipeline/skills/shared/external/swift-formatstyle/SKILL.md +258 -234
  237. package/pipeline/skills/shared/external/swift-language/SKILL.md +342 -382
  238. package/pipeline/skills/shared/external/swift-language/evals/evals.json +24 -27
  239. package/pipeline/skills/shared/external/swift-language/references/swift-attributes-interop.md +79 -56
  240. package/pipeline/skills/shared/external/swift-language/references/swift-patterns-extended.md +297 -340
  241. package/pipeline/skills/shared/external/swift-security/SKILL.md +180 -161
  242. package/pipeline/skills/shared/external/swift-security/evals/evals.json +25 -25
  243. package/pipeline/skills/shared/external/swift-security/references/biometric-authentication.md +314 -469
  244. package/pipeline/skills/shared/external/swift-security/references/certificate-trust.md +408 -476
  245. package/pipeline/skills/shared/external/swift-security/references/common-anti-patterns.md +260 -530
  246. package/pipeline/skills/shared/external/swift-security/references/compliance-owasp-mapping.md +270 -477
  247. package/pipeline/skills/shared/external/swift-security/references/credential-storage-patterns.md +573 -571
  248. package/pipeline/skills/shared/external/swift-security/references/cryptokit-public-key.md +370 -441
  249. package/pipeline/skills/shared/external/swift-security/references/cryptokit-symmetric.md +332 -433
  250. package/pipeline/skills/shared/external/swift-security/references/keychain-access-control.md +346 -468
  251. package/pipeline/skills/shared/external/swift-security/references/keychain-fundamentals.md +352 -472
  252. package/pipeline/skills/shared/external/swift-security/references/keychain-item-classes.md +431 -432
  253. package/pipeline/skills/shared/external/swift-security/references/keychain-sharing.md +328 -425
  254. package/pipeline/skills/shared/external/swift-security/references/migration-legacy-stores.md +341 -579
  255. package/pipeline/skills/shared/external/swift-security/references/secure-enclave.md +396 -457
  256. package/pipeline/skills/shared/external/swift-security/references/testing-security-code.md +354 -614
  257. package/pipeline/skills/shared/external/swift-testing/SKILL.md +188 -175
  258. package/pipeline/skills/shared/external/swift-testing/evals/evals.json +26 -24
  259. package/pipeline/skills/shared/external/swift-testing/references/testing-advanced.md +80 -84
  260. package/pipeline/skills/shared/external/swift-testing/references/testing-patterns.md +317 -433
  261. package/pipeline/skills/shared/external/swiftdata/SKILL.md +392 -256
  262. package/pipeline/skills/shared/external/swiftdata/evals/evals.json +24 -24
  263. package/pipeline/skills/shared/external/swiftdata/references/core-data-coexistence.md +206 -402
  264. package/pipeline/skills/shared/external/swiftdata/references/indexing.md +59 -52
  265. package/pipeline/skills/shared/external/swiftdata/references/predicate-pitfalls.md +57 -33
  266. package/pipeline/skills/shared/external/swiftdata/references/swiftdata-advanced.md +354 -747
  267. package/pipeline/skills/shared/external/swiftdata/references/swiftdata-queries.md +300 -508
  268. package/pipeline/skills/shared/external/swiftlint/SKILL.md +175 -226
  269. package/pipeline/skills/shared/external/swiftlint/references/adoption-and-configuration.md +141 -208
  270. package/pipeline/skills/shared/external/swiftlint/references/custom-rules-and-analyze.md +100 -109
  271. package/pipeline/skills/shared/external/swiftlint/references/plugins-run-scripts-and-integrations.md +159 -179
  272. package/pipeline/skills/shared/external/swiftlint/references/rule-reference.md +383 -18
  273. package/pipeline/skills/shared/external/swiftlint/references/rules-suppressions-and-baselines.md +143 -229
  274. package/pipeline/skills/shared/external/swiftui-animation/SKILL.md +283 -366
  275. package/pipeline/skills/shared/external/swiftui-animation/references/animation-advanced.md +396 -608
  276. package/pipeline/skills/shared/external/swiftui-animation/references/core-animation-bridge.md +336 -385
  277. package/pipeline/skills/shared/external/swiftui-gestures/SKILL.md +239 -349
  278. package/pipeline/skills/shared/external/swiftui-gestures/references/gesture-patterns.md +228 -310
  279. package/pipeline/skills/shared/external/swiftui-layout-components/SKILL.md +260 -249
  280. package/pipeline/skills/shared/external/swiftui-layout-components/references/form.md +92 -74
  281. package/pipeline/skills/shared/external/swiftui-layout-components/references/grids.md +112 -177
  282. package/pipeline/skills/shared/external/swiftui-layout-components/references/list.md +61 -64
  283. package/pipeline/skills/shared/external/swiftui-layout-components/references/scrollview.md +94 -134
  284. package/pipeline/skills/shared/external/swiftui-liquid-glass/SKILL.md +193 -225
  285. package/pipeline/skills/shared/external/swiftui-liquid-glass/references/liquid-glass.md +173 -327
  286. package/pipeline/skills/shared/external/swiftui-navigation/SKILL.md +193 -168
  287. package/pipeline/skills/shared/external/swiftui-navigation/references/deeplinks.md +127 -150
  288. package/pipeline/skills/shared/external/swiftui-navigation/references/navigationstack.md +132 -133
  289. package/pipeline/skills/shared/external/swiftui-navigation/references/sheets.md +152 -117
  290. package/pipeline/skills/shared/external/swiftui-navigation/references/tabview.md +106 -140
  291. package/pipeline/skills/shared/external/swiftui-patterns/SKILL.md +316 -252
  292. package/pipeline/skills/shared/external/swiftui-patterns/references/architecture-patterns.md +341 -332
  293. package/pipeline/skills/shared/external/swiftui-patterns/references/deprecated-migration.md +547 -854
  294. package/pipeline/skills/shared/external/swiftui-patterns/references/design-polish.md +485 -537
  295. package/pipeline/skills/shared/external/swiftui-patterns/references/platform-and-sharing.md +417 -499
  296. package/pipeline/skills/shared/external/swiftui-performance/SKILL.md +213 -376
  297. package/pipeline/skills/shared/external/swiftui-performance/references/demystify-swiftui-performance-wwdc23.md +86 -175
  298. package/pipeline/skills/shared/external/swiftui-performance/references/optimizing-swiftui-performance-instruments.md +89 -195
  299. package/pipeline/skills/shared/external/swiftui-performance/references/understanding-hangs-in-your-app.md +95 -182
  300. package/pipeline/skills/shared/external/swiftui-performance/references/understanding-improving-swiftui-performance.md +71 -149
  301. package/pipeline/skills/shared/external/swiftui-performance/references/wwdc-session-sources.md +21 -27
  302. package/pipeline/skills/shared/external/swiftui-uikit-interop/SKILL.md +303 -295
  303. package/pipeline/skills/shared/external/swiftui-uikit-interop/references/hosting-migration.md +204 -387
  304. package/pipeline/skills/shared/external/swiftui-uikit-interop/references/representable-recipes.md +469 -683
  305. package/pipeline/skills/shared/external/swiftui-webkit/SKILL.md +140 -186
  306. package/pipeline/skills/shared/external/swiftui-webkit/references/loading-and-observation.md +75 -86
  307. package/pipeline/skills/shared/external/swiftui-webkit/references/local-content-and-custom-schemes.md +63 -60
  308. package/pipeline/skills/shared/external/swiftui-webkit/references/migration-and-fallbacks.md +69 -137
  309. package/pipeline/skills/shared/external/swiftui-webkit/references/navigation-and-javascript.md +95 -67
  310. package/pipeline/skills/shared/external/tailwind-css/SKILL.md +1 -0
  311. package/pipeline/skills/shared/external/testing-backend/SKILL.md +1 -0
  312. package/pipeline/skills/shared/external/tipkit/SKILL.md +220 -335
  313. package/pipeline/skills/shared/external/tipkit/references/tipkit-patterns.md +356 -494
  314. package/pipeline/skills/shared/external/typescript-patterns/SKILL.md +1 -0
  315. package/pipeline/skills/shared/external/vision-framework/SKILL.md +260 -375
  316. package/pipeline/skills/shared/external/vision-framework/references/vision-requests.md +393 -515
  317. package/pipeline/skills/shared/external/vision-framework/references/visionkit-scanner.md +363 -539
  318. package/pipeline/skills/shared/external/vue-composition/SKILL.md +1 -0
  319. package/pipeline/skills/shared/external/weatherkit/SKILL.md +152 -310
  320. package/pipeline/skills/shared/external/weatherkit/references/weatherkit-patterns.md +288 -407
  321. package/pipeline/skills/shared/external/web-accessibility/SKILL.md +1 -0
  322. package/pipeline/skills/shared/external/web-performance/SKILL.md +1 -0
  323. package/pipeline/skills/shared/external/web-testing/SKILL.md +1 -0
  324. package/pipeline/skills/shared/external/widgetkit/SKILL.md +216 -288
  325. package/pipeline/skills/shared/external/widgetkit/references/widgetkit-advanced.md +414 -719
  326. package/pipeline/skills/shared/external/NOTICE-swift-ios-skills.md +0 -39
@@ -1,186 +1,180 @@
1
1
  #!/usr/bin/env python3
2
- """Resolve LEGACY translation values for a list of keys.
2
+ """Resolve the legacy translation of each requested key, per language.
3
3
 
4
- PRIMARY source - the in-repo legacy snapshot (`--snapshot-root`): one flat
5
- `<lang>.json` of `{key: value}` per language, refreshed offline by
6
- `fetch-legacy-labels.py`. No network per run.
7
-
8
- `--live` re-reads the project's label endpoint directly, to refresh or to verify the
9
- snapshot. That endpoint is project-specific, so nothing about it is baked in - supply
10
- it the same way `fetch-legacy-labels.py` takes it:
11
-
12
- resolve-legacy-values.py --keys Continue,Cancel --langs all --live \\
13
- --endpoint 'https://labels.example.internal/{env}/labels/{lang}' \\
14
- --headers-file .secrets/label-headers.json
15
-
16
- Prefer --headers-file (JSON object) over repeated --header for anything secret.
17
-
18
- `--prefix` covers backends that store keys under a namespace prefix the app strips
19
- (e.g. a stored `Mobile-Continue` for the app's `Continue`); pass keys WITHOUT it.
20
-
21
- LAST-RESORT offline fallback (`--plist-root`): a legacy iOS app's shipped
22
- `<lang>.lproj/language.plist`. It is typically a stale subset - the snapshot and the
23
- service are authoritative; a plist hit deserves a note in the map.
24
-
25
- Output: `{key: {lang: value|null}}`. Never invent a value - `null` is a valid answer.
4
+ Sources, in order of preference: the in-repo flat snapshot
5
+ (<root>/<lang>.json), bundled language.plist files, or the live label
6
+ endpoint. Values are never invented: a key the source lacks comes back null.
7
+ Prints {key: {lang: value|null}} as JSON.
26
8
  """
27
9
  import argparse
28
10
  import json
29
11
  import os
12
+ import plistlib
30
13
  import sys
31
14
  import urllib.request
32
15
 
33
- LANGS_ALL = ["en", "tr", "ar", "de", "es", "fr", "it", "ru"]
16
+ ALL_LANGS = ["en", "tr", "ar", "de", "es", "fr", "it", "ru"]
34
17
 
35
18
 
36
- def _largest_str_map(obj):
37
- best, stack = {}, [obj]
38
- while stack:
39
- cur = stack.pop()
40
- if isinstance(cur, dict):
41
- strs = {k: v for k, v in cur.items() if isinstance(v, str)}
42
- if len(strs) > len(best):
43
- best = strs
44
- stack.extend(cur.values())
45
- elif isinstance(cur, list):
46
- stack.extend(cur)
47
- return best
19
+ def split_csv(value):
20
+ return [part.strip() for part in value.split(",") if part.strip()]
48
21
 
49
22
 
50
- def _parse_headers(a):
51
- headers = {"Accept": "application/json"}
52
- if a.headers_file:
53
- with open(a.headers_file, encoding="utf-8") as fh:
54
- loaded = json.load(fh)
55
- if not isinstance(loaded, dict):
56
- raise SystemExit(f"--headers-file must be a JSON object, got {type(loaded).__name__}")
57
- headers.update({str(k): str(v) for k, v in loaded.items()})
58
- for pair in a.header or []:
23
+ def parse_langs(value):
24
+ if value.strip() == "all":
25
+ return list(ALL_LANGS)
26
+ return split_csv(value)
27
+
28
+
29
+ def parse_pairs(pairs, flag):
30
+ result = {}
31
+ for pair in pairs or []:
59
32
  if "=" not in pair:
60
- raise SystemExit(f"--header expects K=V, got {pair!r}")
61
- k, v = pair.split("=", 1)
62
- headers[k.strip()] = v.strip()
33
+ raise SystemExit(f"{flag} expects K=V, got {pair!r}")
34
+ key, value = pair.split("=", 1)
35
+ result[key.strip()] = value.strip()
36
+ return result
37
+
38
+
39
+ def build_headers(args):
40
+ headers = {"Accept": "application/json"}
41
+ if args.headers_file:
42
+ with open(args.headers_file, encoding="utf-8") as handle:
43
+ extra = json.load(handle)
44
+ if not isinstance(extra, dict):
45
+ raise SystemExit(f"--headers-file must hold a JSON object: {args.headers_file}")
46
+ headers.update({str(k): str(v) for k, v in extra.items()})
47
+ headers.update(parse_pairs(args.header, "--header"))
63
48
  return headers
64
49
 
65
50
 
66
- def _parse_fail_statuses(values):
67
- out = {}
68
- for pair in values or []:
69
- if "=" not in pair:
70
- raise SystemExit(f"--fail-status expects CODE=message, got {pair!r}")
71
- code, message = pair.split("=", 1)
72
- out[code.strip()] = message.strip()
73
- return out
51
+ def largest_string_map(data):
52
+ best = {}
53
+ stack = [data]
54
+ while stack:
55
+ node = stack.pop()
56
+ if isinstance(node, dict):
57
+ if node and all(isinstance(k, str) and isinstance(v, str) for k, v in node.items()):
58
+ if len(node) > len(best):
59
+ best = node
60
+ stack.extend(node.values())
61
+ elif isinstance(node, list):
62
+ stack.extend(node)
63
+ return best
74
64
 
75
65
 
76
- def fetch(lang, a):
77
- if not a.endpoint:
78
- raise RuntimeError("--live needs --endpoint (no label endpoint is built in)")
79
- url = a.endpoint.format(env=a.env, lang=lang)
80
- headers = _parse_headers(a)
81
- headers.setdefault("Accept-Language", lang)
82
- req = urllib.request.Request(url, headers=headers)
83
- with urllib.request.urlopen(req, timeout=a.timeout) as r:
84
- data = json.loads(r.read().decode("utf-8"))
85
- fail_statuses = _parse_fail_statuses(a.fail_status)
86
- if isinstance(data, dict) and a.status_field in data:
87
- code = str(data.get(a.status_field))
88
- if code in fail_statuses:
89
- raise RuntimeError(f"{url}: {fail_statuses[code]} (status {code})")
90
- m = _largest_str_map(data)
91
- if not m:
92
- raise RuntimeError(f"no label map found in the response for '{lang}' ({url})")
93
- return m
94
-
95
-
96
- def resolve_api(keys, langs, a):
97
- out = {k: {} for k in keys}
66
+ def fetch_labels(endpoint, lang, env, headers, status_field, fail_status, timeout):
67
+ url = endpoint.format(lang=lang, env=env)
68
+ request_headers = dict(headers)
69
+ request_headers.setdefault("Accept-Language", lang)
70
+ request = urllib.request.Request(url, headers=request_headers)
71
+ with urllib.request.urlopen(request, timeout=timeout) as response:
72
+ data = json.loads(response.read().decode("utf-8"))
73
+ if isinstance(data, dict) and status_field in data:
74
+ code = str(data[status_field])
75
+ if code in fail_status:
76
+ raise RuntimeError(f"{url}: {fail_status[code]} (status {code})")
77
+ labels = largest_string_map(data)
78
+ if not labels:
79
+ raise RuntimeError(f"the response for '{lang}' carried no label map ({url})")
80
+ return labels
81
+
82
+
83
+ def lookup(table, key, prefix):
84
+ if prefix and prefix + key in table:
85
+ return table[prefix + key]
86
+ return table.get(key)
87
+
88
+
89
+ def from_snapshot(root, keys, langs, prefix):
90
+ result = {key: {} for key in keys}
98
91
  for lang in langs:
99
- m = fetch(lang, a)
100
- for k in keys:
101
- out[k][lang] = m.get(a.prefix + k, m.get(k))
102
- return out
103
-
104
-
105
- def resolve_snapshot(keys, langs, root, prefix):
106
- """Read the in-repo legacy snapshot (<root>/<lang>.json, flat {key: value}) -
107
- offline, no network. Refresh it with fetch-legacy-labels.py."""
108
- maps = {}
109
- for l in langs:
110
- p = os.path.join(root, f"{l}.json")
111
- if os.path.isfile(p):
112
- with open(p, encoding="utf-8") as fh:
113
- maps[l] = json.load(fh)
92
+ path = os.path.join(root, f"{lang}.json")
93
+ table = {}
94
+ if os.path.isfile(path):
95
+ with open(path, encoding="utf-8") as handle:
96
+ table = json.load(handle)
114
97
  else:
115
- sys.stderr.write(f"# no legacy snapshot for '{l}' under {root}\n")
116
- return {k: {l: maps.get(l, {}).get(prefix + k, maps.get(l, {}).get(k)) for l in langs} for k in keys}
117
-
118
-
119
- def resolve_plist(keys, langs, root, prefix):
120
- import plistlib
121
- pl = {}
122
- for l in langs:
123
- for cand in (os.path.join(root, f"{l}.lproj", "language.plist"), os.path.join(root, f"{l}.plist")):
124
- if os.path.isfile(cand):
125
- with open(cand, "rb") as fh:
126
- pl[l] = plistlib.load(fh)
127
- break
98
+ print(f"# no snapshot file for '{lang}': {path}", file=sys.stderr)
99
+ for key in keys:
100
+ result[key][lang] = lookup(table, key, prefix)
101
+ return result
102
+
103
+
104
+ def from_plist(root, keys, langs, prefix):
105
+ result = {key: {} for key in keys}
106
+ for lang in langs:
107
+ table = {}
108
+ candidates = [os.path.join(root, f"{lang}.lproj", "language.plist"), os.path.join(root, f"{lang}.plist")]
109
+ found = next((p for p in candidates if os.path.isfile(p)), None)
110
+ if found:
111
+ with open(found, "rb") as handle:
112
+ table = plistlib.load(handle)
128
113
  else:
129
- sys.stderr.write(f"# no plist for '{l}' under {root}\n")
130
- return {k: {l: pl.get(l, {}).get(prefix + k, pl.get(l, {}).get(k)) for l in langs} for k in keys}
114
+ print(f"# no plist for '{lang}' under {root}", file=sys.stderr)
115
+ for key in keys:
116
+ result[key][lang] = lookup(table, key, prefix)
117
+ return result
118
+
119
+
120
+ def from_live(args, keys, langs):
121
+ if not args.endpoint:
122
+ raise RuntimeError("--live needs --endpoint (no label endpoint is built in)")
123
+ headers = build_headers(args)
124
+ fail_status = parse_pairs(args.fail_status, "--fail-status")
125
+ result = {key: {} for key in keys}
126
+ for lang in langs:
127
+ table = fetch_labels(args.endpoint, lang, args.env, headers, args.status_field, fail_status, args.timeout)
128
+ for key in keys:
129
+ result[key][lang] = lookup(table, key, args.prefix)
130
+ return result
131
131
 
132
132
 
133
133
  def main():
134
- ap = argparse.ArgumentParser(description=__doc__,
135
- formatter_class=argparse.RawDescriptionHelpFormatter)
136
- ap.add_argument("--keys", required=True,
137
- help="comma-separated legacy keys, WITHOUT the --prefix")
138
- ap.add_argument("--langs", default="en,tr", help="comma-separated langs, or 'all'")
139
- ap.add_argument("--snapshot-root", help="PRIMARY: in-repo legacy snapshot dir - offline, no network")
140
- ap.add_argument("--live", action="store_true",
141
- help="bypass the snapshot and read --endpoint live (to refresh / verify)")
142
- ap.add_argument("--endpoint", help="URL template for the legacy label map; may contain {lang} and {env}")
143
- ap.add_argument("--header", action="append",
144
- help="extra request header as K=V (repeatable); avoid for secrets")
145
- ap.add_argument("--headers-file", help="JSON object of request headers - use this for tokens")
146
- ap.add_argument("--env", default="", help="value substituted for {env} in --endpoint")
147
- ap.add_argument("--status-field", default="statusCode",
148
- help="response field carrying a provider status code")
149
- ap.add_argument("--fail-status", action="append",
150
- help="CODE=message for a provider error code that must abort (repeatable)")
151
- ap.add_argument("--timeout", type=int, default=30)
152
- ap.add_argument("--plist-root", help="last-resort offline fallback: dir with <lang>.lproj/language.plist")
153
- ap.add_argument("--prefix", default="", help="prefix the backend stores keys under (default none)")
154
- a = ap.parse_args()
155
-
156
- langs = LANGS_ALL if a.langs.strip() == "all" else [l.strip() for l in a.langs.split(",") if l.strip()]
157
- keys = [k.strip() for k in a.keys.split(",") if k.strip()]
158
-
159
- # Preference: in-repo snapshot (offline) → live endpoint → plist.
160
- if a.snapshot_root and not a.live:
161
- out = resolve_snapshot(keys, langs, a.snapshot_root, a.prefix)
162
- elif a.plist_root and not a.live and not a.snapshot_root:
163
- sys.stderr.write("# OFFLINE plist fallback - the snapshot/service are the source of truth.\n")
164
- out = resolve_plist(keys, langs, a.plist_root, a.prefix)
134
+ parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
135
+ parser.add_argument("--keys", required=True, help="legacy keys separated by commas; leave off the backend prefix")
136
+ parser.add_argument("--langs", default="en,tr", help="comma list or 'all'")
137
+ parser.add_argument("--snapshot-root", help="directory holding <lang>.json flat snapshots")
138
+ parser.add_argument("--live", action="store_true", help="query the label endpoint instead of the snapshot")
139
+ parser.add_argument("--endpoint", help="URL template with {lang} and optional {env}")
140
+ parser.add_argument("--header", action="append", help="extra request header K=V (repeatable)")
141
+ parser.add_argument("--headers-file", help="JSON object of request headers; keeps secrets off argv")
142
+ parser.add_argument("--env", default="", help="value substituted for {env}")
143
+ parser.add_argument("--status-field", default="statusCode", help="response field carrying a status code")
144
+ parser.add_argument("--fail-status", action="append", help="CODE=message treated as a failure (repeatable)")
145
+ parser.add_argument("--timeout", type=int, default=30)
146
+ parser.add_argument("--plist-root", help="last resort: directory of bundled <lang>.lproj/language.plist")
147
+ parser.add_argument("--prefix", default="", help="backend key prefix the app strips, e.g. Mobile-")
148
+ args = parser.parse_args()
149
+
150
+ keys = split_csv(args.keys)
151
+ langs = parse_langs(args.langs)
152
+
153
+ if args.snapshot_root and not args.live:
154
+ result = from_snapshot(args.snapshot_root, keys, langs, args.prefix)
155
+ elif args.plist_root and not args.live:
156
+ print("# reading bundled plists: a stale subset; trust the snapshot and the service over them", file=sys.stderr)
157
+ result = from_plist(args.plist_root, keys, langs, args.prefix)
165
158
  else:
166
159
  try:
167
- out = resolve_api(keys, langs, a)
160
+ result = from_live(args, keys, langs)
168
161
  except Exception as exc:
169
- sys.stderr.write(f"# live label fetch failed ({exc}).\n")
170
- if a.snapshot_root:
171
- sys.stderr.write("# falling back to --snapshot-root.\n")
172
- out = resolve_snapshot(keys, langs, a.snapshot_root, a.prefix)
173
- elif a.plist_root:
174
- sys.stderr.write("# falling back to --plist-root.\n")
175
- out = resolve_plist(keys, langs, a.plist_root, a.prefix)
162
+ print(f"# live label fetch failed ({exc})", file=sys.stderr)
163
+ if args.snapshot_root:
164
+ result = from_snapshot(args.snapshot_root, keys, langs, args.prefix)
165
+ elif args.plist_root:
166
+ result = from_plist(args.plist_root, keys, langs, args.prefix)
176
167
  else:
177
168
  raise
178
169
 
179
- json.dump(out, sys.stdout, ensure_ascii=False, indent=2)
170
+ json.dump(result, sys.stdout, indent=2, ensure_ascii=False)
180
171
  sys.stdout.write("\n")
181
- absent = [k for k, v in out.items() if not any(v.values())]
182
- if absent:
183
- sys.stderr.write(f"\n# {len(absent)} key(s) with no value: " + ", ".join(absent) + "\n")
172
+
173
+ empty = [key for key, values in result.items() if not any(values.values())]
174
+ if empty:
175
+ print(f"# {len(empty)} key(s) with no legacy value in any requested language:", file=sys.stderr)
176
+ for key in empty:
177
+ print(f"# {key}", file=sys.stderr)
184
178
 
185
179
 
186
180
  if __name__ == "__main__":
@@ -1,170 +1,152 @@
1
1
  #!/usr/bin/env python3
2
- """Bulk-resolve the redesign (new) translation values for a list of localization keys.
3
-
4
- Reads the per-key authored source under
5
- `<resources>/Resources/Localization/LocalizationStrings/Sources/Suggested/<Key>.json`
6
- (SSOT in the resources repo) and prints `{key: {lang: value|null}}`.
7
-
8
- Why a script: the model otherwise hand-copies 8 languages x N keys out of JSON
9
- files - slow, token-heavy, and error-prone. This is pure file IO, so it is a
10
- script. Read-only; touches nothing.
11
-
12
- Key-form handling: code often references a key as `AddAddress.continueButton`
13
- (camelCase leaf) while the Suggested filename PascalCases every dotted segment
14
- (`AddAddress.ContinueButton.json`). We normalise the first character of
15
- each segment to upper-case before resolving, so either form works as input.
16
- Accessibility keys live under `AccessibilityStrings/Sources/Suggested/` - pass
17
- `--domain accessibility` for those.
18
-
19
- `--catalog <file>`: the SHIPPED string catalog, checked whenever a key has no Suggested
20
- file. Pass it. A missing Suggested file means "not in this snapshot", NOT "this key is
21
- unauthored" - the snapshot is a generated mirror and goes stale the moment a key is added
22
- upstream. Concluding "unauthored" from the snapshot alone has already produced a batch of
23
- pointless authoring requests for keys that were shipping in all eight languages. With
24
- `--catalog`, each key reports where its values came from (`suggested` / `catalog`), and
25
- only keys absent from BOTH are reported as genuinely unauthored.
26
-
27
- Accepts an Apple `.xcstrings` (`{"strings": {key: {"localizations": {lang: {"stringUnit":
28
- {"value": ...}}}}}}`) or a flat `{key: {lang: value}}` map.
2
+ """Look up the redesign copy of each given key, one language map per key.
3
+
4
+ The primary source is the Suggested/<Key>.json file of each key, found in a
5
+ resources checkout or a snapshot of it. A key missing there can still be
6
+ answered by a string catalog the app ships (.xcstrings or a flat JSON map).
7
+ Nothing is modified; the JSON result goes to stdout.
29
8
  """
30
9
  import argparse
31
10
  import json
32
11
  import os
33
12
  import sys
34
13
 
35
- DOMAIN_DIR = {
36
- "localization": "LocalizationStrings",
37
- "accessibility": "AccessibilityStrings",
14
+ ALL_LANGS = ["en", "tr", "ar"] + sorted(["ru", "it", "fr", "es", "de"])
15
+
16
+ DOMAIN_DIRS = {
17
+ "localization": ("Suggested", "LocalizationStrings"),
18
+ "accessibility": ("AccessibilitySuggested", "AccessibilityStrings"),
38
19
  }
39
20
 
40
21
 
41
- def normalise(key: str) -> str:
42
- """PascalCase the first char of every dotted segment (file naming convention)."""
43
- return ".".join(s[:1].upper() + s[1:] if s else s for s in key.split("."))
22
+ def parse_langs(value):
23
+ if value.strip() == "all":
24
+ return list(ALL_LANGS)
25
+ return [part.strip() for part in value.split(",") if part.strip()]
26
+
27
+
28
+ def normalize_key(key):
29
+ return ".".join(seg[:1].upper() + seg[1:] for seg in key.split("."))
30
+
31
+
32
+ def read_keys(opts):
33
+ raw = [piece.strip() for piece in opts.keys.split(",")] if opts.keys else []
34
+ if opts.keys_file:
35
+ source = open(opts.keys_file, encoding="utf-8") if opts.keys_file != "-" else sys.stdin
36
+ with source:
37
+ raw += [line.strip() for line in source]
38
+ return list(dict.fromkeys(key for key in raw if key))
44
39
 
45
40
 
46
- SNAPSHOT_SUBDIR = {"localization": "Suggested", "accessibility": "AccessibilitySuggested"}
41
+ def suggested_dir(opts):
42
+ if opts.suggested_dir:
43
+ return opts.suggested_dir
44
+ snapshot_name, source_name = DOMAIN_DIRS[opts.domain]
45
+ root = opts.resources_root
46
+ snapshot = os.path.join(root, "Localization", snapshot_name)
47
+ if os.path.isdir(snapshot):
48
+ return snapshot
49
+ return os.path.join(root, "Resources", "Localization", source_name, "Sources", "Suggested")
47
50
 
48
51
 
49
- def suggested_dir(resources_root: str, domain: str) -> str:
50
- # In-repo snapshot layout first (specs/resources/Localization/Suggested) - single-repo, offline;
51
- # else the full the resources repo layout.
52
- snap = os.path.join(resources_root, "Localization", SNAPSHOT_SUBDIR[domain])
53
- if os.path.isdir(snap):
54
- return snap
55
- return os.path.join(
56
- resources_root, "Resources", "Localization",
57
- DOMAIN_DIR[domain], "Sources", "Suggested",
58
- )
52
+ def read_json(path):
53
+ with open(path, encoding="utf-8") as stream:
54
+ return json.load(stream)
59
55
 
60
56
 
61
- def resolve(key: str, sug_dir: str, langs):
62
- path = os.path.join(sug_dir, normalise(key) + ".json")
63
- if not os.path.isfile(path):
64
- return None # absent from THIS snapshot - see load_catalog before concluding
65
- with open(path, encoding="utf-8") as fh:
66
- data = json.load(fh)
67
- out = {}
68
- for lang in langs:
69
- entry = data.get(lang)
70
- out[lang] = entry.get("value") if isinstance(entry, dict) else None
71
- return out
57
+ def xcstrings_values(entry):
58
+ found = {}
59
+ for lang, localization in ((entry or {}).get("localizations") or {}).items():
60
+ unit = (localization or {}).get("stringUnit") or {}
61
+ if "value" in unit:
62
+ found[lang] = unit["value"]
63
+ return found
72
64
 
73
65
 
74
66
  def load_catalog(path):
75
- """{key: {lang: value}} from an .xcstrings or an already-flat catalog."""
76
- if not path:
67
+ data = read_json(path)
68
+ if not isinstance(data, dict):
77
69
  return {}
78
- with open(path, encoding="utf-8") as fh:
79
- raw = json.load(fh)
80
- strings = raw.get("strings") if isinstance(raw, dict) else None
81
- if not isinstance(strings, dict):
82
- return raw if isinstance(raw, dict) else {}
83
- out = {}
84
- for key, entry in strings.items():
85
- locs = (entry or {}).get("localizations") or {}
86
- out[key] = {lang: ((v or {}).get("stringUnit") or {}).get("value")
87
- for lang, v in locs.items()}
88
- return out
89
-
90
-
91
- def resolve_from_catalog(key, catalog, langs):
92
- for cand in (key, normalise(key)):
93
- vals = catalog.get(cand)
94
- if vals:
95
- return {lang: vals.get(lang) for lang in langs}
96
- return None
70
+ strings = data.get("strings")
71
+ if isinstance(strings, dict):
72
+ return {key: xcstrings_values(entry) for key, entry in strings.items()}
73
+ return data
74
+
75
+
76
+ def read_suggested(path, langs):
77
+ data = read_json(path)
78
+ per_lang = data if isinstance(data, dict) else {}
79
+
80
+ def value_of(lang):
81
+ block = per_lang.get(lang)
82
+ return block.get("value") if isinstance(block, dict) else None
83
+
84
+ return {lang: value_of(lang) for lang in langs}
85
+
86
+
87
+ def from_catalog(catalog, key, langs):
88
+ entry = catalog.get(key)
89
+ if entry is None:
90
+ entry = catalog.get(normalize_key(key))
91
+ if not isinstance(entry, dict):
92
+ return None
93
+ return {lang: entry.get(lang) for lang in langs}
97
94
 
98
95
 
99
96
  def main():
100
- ap = argparse.ArgumentParser(description=__doc__)
101
- ap.add_argument("--keys", help="comma-separated keys (code- or file-form)")
102
- ap.add_argument("--keys-file", help="file with one key per line (- for stdin)")
103
- ap.add_argument("--resources-root",
104
- help="resources checkout OR the in-repo snapshot root (specs/resources)")
105
- ap.add_argument("--suggested-dir", help="explicit Suggested dir (overrides --resources-root detection)")
106
- ap.add_argument("--domain", choices=list(DOMAIN_DIR), default="localization")
107
- ap.add_argument("--catalog", help="shipped string catalog (.xcstrings or flat JSON) used "
108
- "whenever a key has no Suggested file - pass it, or a "
109
- "stale snapshot reads as 'unauthored'")
110
- ap.add_argument("--report-source", action="store_true",
111
- help="emit {key: {source, values}} instead of {key: values}")
112
- ap.add_argument("--langs", default="en,tr",
113
- help="comma-separated langs, or 'all' (ar,de,en,es,fr,it,ru,tr)")
114
- args = ap.parse_args()
115
-
116
- if args.langs.strip() == "all":
117
- langs = ["ar", "de", "en", "es", "fr", "it", "ru", "tr"]
118
- else:
119
- langs = [l.strip() for l in args.langs.split(",") if l.strip()]
120
-
121
- keys = []
122
- if args.keys:
123
- keys += [k.strip() for k in args.keys.split(",") if k.strip()]
124
- if args.keys_file:
125
- src = sys.stdin if args.keys_file == "-" else open(args.keys_file, encoding="utf-8")
126
- keys += [ln.strip() for ln in src if ln.strip()]
97
+ cli = argparse.ArgumentParser(description=__doc__.splitlines()[0])
98
+ cli.add_argument("--keys", help="keys separated by commas, in code form or file form")
99
+ cli.add_argument("--keys-file", help="one key per line; use - to read stdin")
100
+ cli.add_argument("--resources-root", help="root of the resources checkout or of its snapshot")
101
+ cli.add_argument("--suggested-dir", help="use this Suggested folder instead of looking for one")
102
+ cli.add_argument("--domain", default="localization", choices=sorted(DOMAIN_DIRS))
103
+ cli.add_argument("--catalog", help="string catalog the app ships (.xcstrings or flat JSON), consulted when a key has no Suggested file")
104
+ cli.add_argument("--report-source", action="store_true", help="return {source, values} per key instead of the bare values")
105
+ cli.add_argument("--langs", default="en,tr", help="languages separated by commas, or 'all'")
106
+ opts = cli.parse_args()
107
+
108
+ keys = read_keys(opts)
127
109
  if not keys:
128
- ap.error("supply --keys and/or --keys-file")
129
-
130
- if args.suggested_dir:
131
- sug_dir = args.suggested_dir
132
- elif args.resources_root:
133
- sug_dir = suggested_dir(args.resources_root, args.domain)
134
- else:
135
- ap.error("supply --resources-root or --suggested-dir")
136
- if not os.path.isdir(sug_dir):
137
- ap.error(f"Suggested dir not found: {sug_dir} (is --resources-root / --suggested-dir correct?)")
138
-
139
- catalog = load_catalog(args.catalog)
140
- result, source = {}, {}
141
- for k in keys:
142
- vals = resolve(k, sug_dir, langs)
143
- src = "suggested" if vals is not None else None
144
- if vals is None and catalog:
145
- vals = resolve_from_catalog(k, catalog, langs)
146
- src = "catalog" if vals is not None else None
147
- result[k] = vals
148
- source[k] = src
149
-
150
- if args.report_source:
151
- json.dump({k: {"source": source[k], "values": result[k]} for k in keys},
152
- sys.stdout, ensure_ascii=False, indent=2)
153
- else:
154
- json.dump(result, sys.stdout, ensure_ascii=False, indent=2)
110
+ cli.error("supply --keys and/or --keys-file")
111
+ if not (opts.resources_root or opts.suggested_dir):
112
+ cli.error("supply --resources-root or --suggested-dir")
113
+ directory = suggested_dir(opts)
114
+ if not os.path.isdir(directory):
115
+ cli.error(f"no Suggested folder at {directory} (check --resources-root / --suggested-dir / --domain)")
116
+
117
+ langs = parse_langs(opts.langs)
118
+ catalog = load_catalog(opts.catalog) if opts.catalog else None
119
+
120
+ result, via_catalog, unresolved = {}, [], []
121
+ for key in keys:
122
+ path = os.path.join(directory, normalize_key(key) + ".json")
123
+ source, values = None, None
124
+ if os.path.isfile(path):
125
+ source, values = "suggested", read_suggested(path, langs)
126
+ elif catalog is not None:
127
+ values = from_catalog(catalog, key, langs)
128
+ if values is not None:
129
+ source = "catalog"
130
+ via_catalog.append(key)
131
+ if values is None:
132
+ unresolved.append(key)
133
+ result[key] = values if not opts.report_source else {"source": source, "values": values}
134
+
135
+ json.dump(result, sys.stdout, indent=2, ensure_ascii=False)
155
136
  sys.stdout.write("\n")
156
137
 
157
- from_catalog = [k for k in keys if source[k] == "catalog"]
158
- unauthored = [k for k in keys if source[k] is None]
159
- if from_catalog:
160
- sys.stderr.write(
161
- f"\n# {len(from_catalog)} key(s) resolved from the CATALOG, not the snapshot - "
162
- "the snapshot is stale, refresh it with snapshot-resources.sh: "
163
- + ", ".join(from_catalog) + "\n")
164
- if unauthored:
165
- label = ("with no authored source" if catalog else
166
- "absent from the snapshot (no --catalog given, so 'unauthored' is UNVERIFIED)")
167
- sys.stderr.write(f"\n# {len(unauthored)} key(s) {label}: " + ", ".join(unauthored) + "\n")
138
+ def listing(header, items):
139
+ print(f"# {len(items)} key(s) {header}:", file=sys.stderr)
140
+ for item in items:
141
+ print(f"# {item}", file=sys.stderr)
142
+
143
+ if via_catalog:
144
+ listing("came from the catalog because the snapshot lacks them; run snapshot-resources.sh to refresh it", via_catalog)
145
+ if unresolved:
146
+ if catalog is None:
147
+ listing("are not in the snapshot (without --catalog, calling them 'unauthored' is UNVERIFIED)", unresolved)
148
+ else:
149
+ listing("have no authored source anywhere", unresolved)
168
150
 
169
151
 
170
152
  if __name__ == "__main__":