@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,37 +1,11 @@
1
1
  #!/usr/bin/env python3
2
- """Fetch the content team's Final UX Writing annotations off the screen's Figma nodes.
3
-
4
- The CMS / content team writes the **final bilingual copy** as Figma Dev Mode
5
- annotations (category "Final UX Writing") directly on the text nodes, in the form
6
- `TR: <türkçe>\nEN: <english>`. The design text itself is usually a *placeholder*
7
- ("Giriniz", "Lorem ipsum", "Ahmet Abdullah"), so the annotation - not the design
8
- text - is the content team's *actual* value. This script harvests them so the map
9
- can show an `İçerik (CMS)` column beside the new (resources) and legacy values.
10
-
11
- Three sources, in priority order (Figma changes constantly → live is primary):
12
- 1. REST - `GET https://api.figma.com/v1/files/<key>/nodes?ids=...`, header
13
- `X-Figma-Token` (from --token, env FIGMA_ACCESS_TOKEN/FIGMA_TOKEN, or
14
- the macOS keychain item `FIGMA_ACCESS_TOKEN`). Default.
15
- 2. MCP - `--from-mcp <raw.json>`: an already-captured Dev Mode dump (the host's
16
- Figma plugin/`use_figma` output). No network, no rate limit - use it
17
- for big runs or when REST is 429-throttled.
18
- 3. local - `--local <design-export-screen-dir>`: best-effort read of the in-repo
19
- snapshot's `tree.json` (only if it carries `annotations`). The safety
20
- net when neither API nor MCP is reachable; usually yields nothing, in
21
- which case the CMS column is simply left blank (blank beats a guess).
22
-
23
- Why a script: parsing `TR:/EN:` labels out of a node tree across many nodes is
24
- pure IO + string work - slow and error-prone by hand. Read-only; touches no repo.
25
-
26
- Emits the `_annotations.json` contract (to --out or stdout):
27
- { generatedAt, source, files[], auditedNodes[], count, withTr, withEn,
28
- annotations: [ {nodeId, name, type, designText, raw, tr, en, mode} ] }
29
-
30
- The label→{tr,en} parser (`split_lang`) is a faithful port of the web skill's
31
- `lib/split-lang.mjs`, so iOS/Android and web stay byte-compatible on the rules.
2
+ """Gather the "Final UX Writing" Dev Mode annotations of a Figma screen into _annotations.json.
3
+
4
+ The REST API is tried first; a saved MCP dump (--from-mcp) or the tree.json of
5
+ a design export kept in the repo (--local) can stand in for it. The TR and EN
6
+ copy of each annotation is separated. Nothing is written back to Figma.
32
7
  """
33
8
  import argparse
34
- import datetime
35
9
  import json
36
10
  import os
37
11
  import re
@@ -41,303 +15,268 @@ import sys
41
15
  import urllib.error
42
16
  import urllib.parse
43
17
  import urllib.request
18
+ from datetime import datetime, timezone
44
19
 
45
- FIGMA_API = "https://api.figma.com/v1"
46
- CHUNK = 4 # Figma /nodes batches; mirrors the web extractor
47
-
48
- # --- label → {tr, en, mode} - verbatim port of lib/split-lang.mjs ----------
49
- # Annotation authors separate label from value with a colon, a hyphen, or the
50
- # en-dash their editor auto-inserts. Built from the codepoint so this file
51
- # carries no literal dash variant of its own.
52
- _DASHES = ':\\-' + chr(0x2013)
53
- RE_TR = re.compile(rf"^(?:tr|tr[kc]e|t[üu]rk[çc]e)\s*[{_DASHES}]\s*(.+)$", re.I)
54
- RE_EN = re.compile(rf"^(?:en|eng|ing|[iİ]ngilizce)\s*[{_DASHES}]\s*(.+)$", re.I)
55
-
56
-
57
- def split_lang(raw):
58
- """Parse a Dev Mode annotation label into {tr, en, mode}.
59
-
60
- Prefixed `TR:`/`EN:` lines win over position; otherwise line1=TR, line2=EN.
61
- """
62
- if not raw:
63
- return {"tr": None, "en": None, "mode": "empty"}
64
- lines = [ln.strip() for ln in re.split(r"\r?\n", raw)]
65
- lines = [ln for ln in lines if ln]
66
- tr = en = None
67
- bare = []
68
- for ln in lines:
69
- m = RE_TR.match(ln)
70
- if m and tr is None:
71
- tr = m.group(1).strip()
72
- continue
73
- m = RE_EN.match(ln)
74
- if m and en is None:
75
- en = m.group(1).strip()
76
- continue
77
- bare.append(ln)
78
- if tr is not None or en is not None:
79
- bi = 0
80
- if tr is None and bi < len(bare):
81
- tr = bare[bi]
82
- bi += 1
83
- if en is None and bi < len(bare):
84
- en = bare[bi]
85
- bi += 1
86
- return {"tr": tr, "en": en, "mode": "prefixed"}
87
- if len(bare) >= 2:
88
- return {"tr": bare[0], "en": bare[1], "mode": "two-line"}
89
- if len(bare) == 1:
90
- return {"tr": bare[0], "en": None, "mode": "single"}
91
- return {"tr": None, "en": None, "mode": "empty"}
92
-
93
-
94
- def canon_id(s):
95
- """`1234-56` (URL form) → `1234:56` (node-id form); trims."""
96
- return re.sub(r"^(\d+)-(\d+)$", r"\1:\2", (s or "").strip())
97
-
98
-
99
- # --- annotation parsing ----------------------------------------------------
100
- def labels_of(node):
101
- """The annotation label strings on a node (each `label` ?? `labelMarkdown`)."""
102
- anns = node.get("annotations")
103
- if not isinstance(anns, list):
104
- return []
105
- out = []
106
- for a in anns:
107
- if not isinstance(a, dict):
108
- continue
109
- lbl = a.get("label") or a.get("labelMarkdown") or ""
110
- if lbl:
111
- out.append(lbl)
112
- return out
113
-
114
-
115
- def design_text(node):
116
- if node.get("type") == "TEXT" and isinstance(node.get("characters"), str):
117
- return node["characters"]
118
- return node.get("name")
119
-
120
-
121
- def parse_item(node_id, name, ntype, dtext, labels):
122
- """Run split_lang over each label; keep the first that yields tr or en."""
123
- best = {"tr": None, "en": None, "mode": "empty"}
124
- raw = ""
125
- for lbl in (labels or []):
126
- parsed = split_lang(lbl)
127
- if parsed["tr"] is not None or parsed["en"] is not None:
128
- best = parsed
129
- raw = lbl
130
- break
131
- if not raw:
132
- raw = lbl
20
+ API = "https://api.figma.com/v1"
21
+ BATCH = 4
22
+ SEP = "[:\\-\u2013]"
23
+ TR_RE = re.compile("^(?:tr|tr[kc]e|t[\u00fcu]rk[\u00e7c]e)\\s*" + SEP + "\\s*(.+)$", re.IGNORECASE)
24
+ EN_RE = re.compile("^(?:en|eng|ing|[i\u0130]ngilizce)\\s*" + SEP + "\\s*(.+)$", re.IGNORECASE)
25
+
26
+
27
+ def canon_id(node_id):
28
+ return str(node_id).strip().replace("-", ":")
29
+
30
+
31
+ def split_lang(text):
32
+ picked = {"tr": None, "en": None}
33
+ loose = []
34
+ for line in filter(None, (piece.strip() for piece in str(text or "").splitlines())):
35
+ tr_hit, en_hit = TR_RE.match(line), EN_RE.match(line)
36
+ if tr_hit and picked["tr"] is None:
37
+ picked["tr"] = tr_hit.group(1).strip()
38
+ elif en_hit and picked["en"] is None:
39
+ picked["en"] = en_hit.group(1).strip()
40
+ else:
41
+ loose.append(line)
42
+ if picked["tr"] is None and picked["en"] is None:
43
+ padded = loose + [None, None]
44
+ style = {0: "empty", 1: "single"}.get(len(loose), "two-line")
45
+ return {"tr": padded[0], "en": padded[1], "mode": style}
46
+ spare = iter(loose)
47
+ for lang in ("tr", "en"):
48
+ if picked[lang] is None:
49
+ picked[lang] = next(spare, None)
50
+ return dict(picked, mode="prefixed")
51
+
52
+
53
+ def label_text(annotation):
54
+ if isinstance(annotation, dict):
55
+ return annotation.get("label") or annotation.get("labelMarkdown") or ""
56
+ return str(annotation or "")
57
+
58
+
59
+ def pick_label(labels):
60
+ for label in labels:
61
+ parsed = split_lang(label)
62
+ if parsed["tr"] or parsed["en"]:
63
+ return label, parsed
64
+ first = labels[0] if labels else ""
65
+ return first, split_lang(first)
66
+
67
+
68
+ def record(node_id, name, node_type, design_text, labels):
69
+ raw, parsed = pick_label(labels)
133
70
  return {
134
- "nodeId": node_id,
71
+ "nodeId": canon_id(node_id),
135
72
  "name": name,
136
- "type": ntype,
137
- "designText": dtext,
73
+ "type": node_type,
74
+ "designText": design_text,
138
75
  "raw": raw,
139
- "tr": best["tr"],
140
- "en": best["en"],
141
- "mode": best["mode"],
76
+ "tr": parsed["tr"],
77
+ "en": parsed["en"],
78
+ "mode": parsed["mode"],
142
79
  }
143
80
 
144
81
 
145
- def walk_collect(node, out):
146
- """Recurse a Figma node tree, collecting every node that carries annotations."""
147
- labels = labels_of(node)
148
- if labels:
149
- out.append(parse_item(node.get("id"), node.get("name"),
150
- node.get("type"), design_text(node), labels))
151
- for child in node.get("children", []) or []:
152
- walk_collect(child, out)
153
-
154
-
155
- # --- sources ---------------------------------------------------------------
156
- def figma_token(args):
157
- if args.token:
158
- return args.token
159
- for env in ("FIGMA_ACCESS_TOKEN", "FIGMA_TOKEN"):
160
- v = os.environ.get(env)
161
- if v:
162
- return v.strip()
82
+ def walk_nodes(root):
83
+ stack = [root]
84
+ while stack:
85
+ node = stack.pop()
86
+ if not isinstance(node, dict):
87
+ continue
88
+ yield node
89
+ stack.extend(reversed(node.get("children") or []))
90
+
91
+
92
+ def annotated(root):
93
+ found = []
94
+ for node in walk_nodes(root):
95
+ notes = node.get("annotations")
96
+ if isinstance(notes, list) and notes:
97
+ node_type = node.get("type")
98
+ design = node.get("characters") if node_type == "TEXT" else node.get("name")
99
+ node_id = node.get("id") or node.get("nodeId")
100
+ found.append(record(node_id, node.get("name"), node_type, design, [label_text(a) for a in notes]))
101
+ return found
102
+
103
+
104
+ def keychain_secret(service):
163
105
  try:
164
- r = subprocess.run(
165
- ["security", "find-generic-password", "-s", "FIGMA_ACCESS_TOKEN", "-w"],
166
- capture_output=True, text=True)
167
- if r.returncode == 0 and r.stdout.strip():
168
- return r.stdout.strip()
169
- except Exception:
170
- pass
171
- return None
172
-
173
-
174
- def http_get_json(url, headers, ca_file):
175
- ctx = ssl.create_default_context(cafile=ca_file) if ca_file else ssl.create_default_context()
176
- req = urllib.request.Request(url, headers=headers)
106
+ lookup = subprocess.run(
107
+ ["security", "find-generic-password", "-s", service, "-w"],
108
+ capture_output=True, text=True, timeout=10,
109
+ )
110
+ except (OSError, subprocess.SubprocessError):
111
+ return None
112
+ secret = lookup.stdout.strip()
113
+ return secret if lookup.returncode == 0 and secret else None
114
+
115
+
116
+ def figma_token(explicit):
117
+ if explicit:
118
+ return explicit
119
+ from_env = next((os.environ[v] for v in ("FIGMA_ACCESS_TOKEN", "FIGMA_TOKEN") if os.environ.get(v)), None)
120
+ return from_env or keychain_secret("FIGMA_ACCESS_TOKEN")
121
+
122
+
123
+ def get_json(url, token, ca_file, timeout=60):
124
+ tls = ssl.create_default_context(cafile=ca_file) if ca_file else None
125
+ call = urllib.request.Request(url, headers={"X-Figma-Token": token})
177
126
  try:
178
- with urllib.request.urlopen(req, context=ctx, timeout=60) as r:
179
- return json.load(r)
180
- except urllib.error.HTTPError as e:
181
- if e.code == 429:
182
- sys.exit("Figma 429 (rate-limited) - re-run with the MCP dump instead: "
183
- "--from-mcp <raw.json>.")
184
- body = e.read()[:200]
185
- sys.exit(f"Figma HTTP {e.code} for {url}: {body!r}")
186
- except urllib.error.URLError as e:
187
- msg = str(getattr(e, "reason", e))
188
- if re.search(r"CERTIFICATE|ISSUER|SELF.SIGNED|UNABLE_TO|CERT", msg, re.I):
127
+ with urllib.request.urlopen(call, timeout=timeout, context=tls) as response:
128
+ return json.loads(response.read().decode("utf-8"))
129
+ except urllib.error.HTTPError as exc:
130
+ if exc.code == 429:
131
+ sys.exit("Figma is rate limiting (HTTP 429). Dump the annotations with Figma MCP instead and pass that file via --from-mcp <raw.json>.")
132
+ snippet = exc.read()[:200].decode("utf-8", "replace")
133
+ sys.exit(f"Figma HTTP {exc.code} for {url}: {snippet}")
134
+ except urllib.error.URLError as exc:
135
+ why = str(exc.reason)
136
+ if any(marker in why.upper() for marker in ("CERTIFICATE", "SSL")):
189
137
  sys.exit(
190
- "TLS verification failed. Behind a corporate proxy, export the system "
191
- "roots and pass --ca-file:\n"
192
- " security find-certificate -a -p /System/Library/Keychains/"
193
- "SystemRootCertificates.keychain > /tmp/ca.pem\n"
194
- " security find-certificate -a -p /Library/Keychains/System.keychain "
195
- ">> /tmp/ca.pem\n"
196
- " ... --ca-file /tmp/ca.pem")
197
- sys.exit(f"Figma request failed: {msg}")
138
+ "Could not verify TLS, most likely because a proxy signs traffic with its own root. "
139
+ "Write the system roots out with `security find-certificate -a -p > roots.pem` and add --ca-file roots.pem."
140
+ )
141
+ sys.exit(f"Could not reach Figma: {why}")
198
142
 
199
143
 
200
144
  def from_rest(file_key, node_ids, token, ca_file):
201
- if not token:
202
- sys.exit("No Figma token - pass --token, set FIGMA_ACCESS_TOKEN, or add the "
203
- "keychain item FIGMA_ACCESS_TOKEN (or use --from-mcp / --local).")
204
- headers = {"X-Figma-Token": token}
205
- collected = []
206
- ids = [canon_id(n) for n in node_ids]
207
- for i in range(0, len(ids), CHUNK):
208
- batch = ids[i:i + CHUNK]
209
- q = ",".join(urllib.parse.quote(n, safe="") for n in batch)
210
- data = http_get_json(f"{FIGMA_API}/files/{file_key}/nodes?ids={q}", headers, ca_file)
211
- for nid in batch:
212
- entry = (data.get("nodes") or {}).get(nid)
213
- doc = entry.get("document") if isinstance(entry, dict) else None
214
- if doc:
215
- walk_collect(doc, collected)
216
- return collected, "rest"
145
+ wanted = list(map(canon_id, node_ids))
146
+ found = []
147
+ for offset in range(0, len(wanted), BATCH):
148
+ chunk = wanted[offset:offset + BATCH]
149
+ joined = urllib.parse.quote(",".join(chunk), safe="")
150
+ reply = get_json(f"{API}/files/{file_key}/nodes?ids={joined}", token, ca_file)
151
+ by_id = reply.get("nodes") or {}
152
+ for node_id in chunk:
153
+ document = (by_id.get(node_id) or {}).get("document")
154
+ if document:
155
+ found.extend(annotated(document))
156
+ return found, [file_key], wanted
157
+
158
+
159
+ def read_json(path):
160
+ with open(path, encoding="utf-8") as stream:
161
+ return json.load(stream)
217
162
 
218
163
 
219
164
  def from_mcp(path):
220
- with open(path, encoding="utf-8") as fh:
221
- dump = json.load(fh)
222
- items = dump if isinstance(dump, list) else (dump.get("annotations") or dump.get("items") or [])
223
- collected = []
224
- files = []
225
- for it in items:
226
- fk = it.get("fileKey")
227
- if fk and fk not in files:
228
- files.append(fk)
229
- labels = it.get("labels")
230
- if labels is None and it.get("raw") is not None:
231
- labels = [it["raw"]]
232
- collected.append(parse_item(it.get("nodeId"), it.get("name"), it.get("type"),
233
- it.get("designText"), labels or []))
234
- return collected, "mcp", files
235
-
236
-
237
- def from_local(screen_dir):
238
- """Best-effort: read annotations from a design-export tree.json if it has any."""
239
- tree = os.path.join(screen_dir, "tree.json")
165
+ data = read_json(path)
166
+ if isinstance(data, dict):
167
+ items = data.get("annotations") or data.get("items") or []
168
+ else:
169
+ items = data
170
+ found, files, audited = [], [], []
171
+ for item in items:
172
+ if not isinstance(item, dict):
173
+ continue
174
+ labels = item.get("labels")
175
+ if not isinstance(labels, list):
176
+ labels = [item.get("raw")] if item.get("raw") else []
177
+ found.append(record(item.get("nodeId"), item.get("name"), item.get("type"), item.get("designText"), [label_text(l) for l in labels]))
178
+ if item.get("fileKey") and item["fileKey"] not in files:
179
+ files.append(item["fileKey"])
180
+ if item.get("nodeId"):
181
+ audited.append(canon_id(item["nodeId"]))
182
+ return found, files, audited
183
+
184
+
185
+ def from_local(directory):
186
+ tree = os.path.join(directory, "tree.json")
240
187
  if not os.path.isfile(tree):
241
- return [], "local"
242
- with open(tree, encoding="utf-8") as fh:
243
- data = json.load(fh)
244
- roots = data if isinstance(data, list) else [data]
245
- collected = []
246
- for root in roots:
247
- if isinstance(root, dict):
248
- walk_collect(root, collected)
249
- return collected, "local"
188
+ return [], [], []
189
+ data = read_json(tree)
190
+ frames = [data] if not isinstance(data, list) else data
191
+ found = [item for frame in frames for item in annotated(frame)]
192
+ ids = [frame.get("nodeId") or frame.get("id") for frame in frames if isinstance(frame, dict)]
193
+ return found, [], [canon_id(i) for i in ids if i]
194
+
195
+
196
+ def pick_source(opts, cli, file_key, nodes):
197
+ if opts.from_mcp or opts.source == "mcp":
198
+ if not opts.from_mcp:
199
+ cli.error("--source mcp needs --from-mcp <raw.json>")
200
+ return ("mcp",) + from_mcp(opts.from_mcp)
201
+ if opts.source == "local":
202
+ if not opts.local:
203
+ cli.error("--source local needs --local <design-export-screen-dir>")
204
+ return ("local",) + from_local(opts.local)
205
+ have_target = bool(file_key and nodes)
206
+ if opts.source == "rest":
207
+ if not have_target:
208
+ cli.error("--source rest needs a file key and node-ids (--file/--nodes or --mapping)")
209
+ token = figma_token(opts.token)
210
+ if not token:
211
+ sys.exit("No Figma token found. Export FIGMA_ACCESS_TOKEN or FIGMA_TOKEN, keep it in the keychain under FIGMA_ACCESS_TOKEN, or use --token.")
212
+ return ("rest",) + from_rest(file_key, nodes, token, opts.ca_file)
213
+ token = figma_token(opts.token) if have_target else None
214
+ if have_target and token:
215
+ try:
216
+ return ("rest",) + from_rest(file_key, nodes, token, opts.ca_file)
217
+ except SystemExit as exc:
218
+ if not opts.local:
219
+ raise
220
+ print(f"# REST fetch did not work ({exc}); using --local instead", file=sys.stderr)
221
+ return ("local",) + from_local(opts.local)
222
+ if opts.local:
223
+ return ("local",) + from_local(opts.local)
224
+ cli.error("nothing to do: give --file/--nodes (or --mapping) with a token, --from-mcp, or --local")
250
225
 
251
226
 
252
227
  def main():
253
- ap = argparse.ArgumentParser(description=__doc__,
254
- formatter_class=argparse.RawDescriptionHelpFormatter)
255
- ap.add_argument("--file", help="Figma fileKey (REST)")
256
- ap.add_argument("--nodes", help="comma-separated node-ids (REST), e.g. '10065:56313,10065:56329'")
257
- ap.add_argument("--mapping", help="a mapping JSON to read figmaFileKey + figmaNodes from")
258
- ap.add_argument("--from-mcp", dest="from_mcp", help="captured Dev Mode dump (MCP path)")
259
- ap.add_argument("--local", help="design-export screen dir (fallback; reads tree.json)")
260
- ap.add_argument("--source", choices=["auto", "rest", "mcp", "local"], default="auto",
261
- help="force a source; 'auto' tries REST then --local (default)")
262
- ap.add_argument("--token", help="Figma token (else env / keychain)")
263
- ap.add_argument("--ca-file", help="CA bundle for TLS behind a corporate proxy")
264
- ap.add_argument("--out", help="write _annotations.json here (default: stdout)")
265
- args = ap.parse_args()
266
-
267
- file_key = args.file
268
- node_ids = [n.strip() for n in (args.nodes or "").split(",") if n.strip()]
269
- if args.mapping:
270
- with open(args.mapping, encoding="utf-8") as fh:
271
- m = json.load(fh)
272
- file_key = file_key or m.get("figmaFileKey")
273
- if not node_ids:
274
- node_ids = [str(n) for n in (m.get("figmaNodes") or [])]
275
-
276
- files = [file_key] if file_key else []
277
- source = args.source
278
-
279
- if args.from_mcp or source == "mcp":
280
- if not args.from_mcp:
281
- ap.error("--source mcp needs --from-mcp <raw.json>")
282
- collected, source, mcp_files = from_mcp(args.from_mcp)
283
- files = mcp_files or files
284
- elif source == "local":
285
- if not args.local:
286
- ap.error("--source local needs --local <dir>")
287
- collected, source = from_local(args.local)
288
- elif source == "rest":
289
- if not (file_key and node_ids):
290
- ap.error("REST needs --file and --nodes (or --mapping)")
291
- collected, source = from_rest(file_key, node_ids, figma_token(args), args.ca_file)
292
- else: # auto: REST first, fall back to --local
293
- if file_key and node_ids and figma_token(args):
294
- try:
295
- collected, source = from_rest(file_key, node_ids, figma_token(args), args.ca_file)
296
- except SystemExit:
297
- if not args.local:
298
- raise
299
- sys.stderr.write("# REST failed - falling back to --local\n")
300
- collected, source = from_local(args.local)
301
- elif args.local:
302
- collected, source = from_local(args.local)
303
- else:
304
- ap.error("nothing to do - supply --file/--nodes (or --mapping) for REST, "
305
- "--from-mcp for MCP, or --local for the snapshot fallback")
306
-
307
- # de-dup by nodeId, keep first (REST returns each requested node once anyway)
308
- seen = set()
309
- deduped = []
310
- for a in collected:
311
- nid = a.get("nodeId")
312
- if nid in seen:
313
- continue
314
- seen.add(nid)
315
- deduped.append(a)
316
-
317
- out = {
318
- "generatedAt": datetime.datetime.now(datetime.timezone.utc).isoformat(),
228
+ cli = argparse.ArgumentParser(description=__doc__.splitlines()[0])
229
+ cli.add_argument("--file", help="key of the Figma file")
230
+ cli.add_argument("--nodes", help="frame node-ids, separated by commas")
231
+ cli.add_argument("--mapping", help="mapping JSON; its figmaFileKey and figmaNodes fill in for missing flags")
232
+ cli.add_argument("--from-mcp", help="JSON dump of annotations taken through MCP")
233
+ cli.add_argument("--local", help="screen folder of a design export that contains tree.json")
234
+ cli.add_argument("--source", default="auto", choices=["auto", "rest", "mcp", "local"])
235
+ cli.add_argument("--token", help="Figma token; FIGMA_ACCESS_TOKEN or the keychain is safer since other processes can read argv")
236
+ cli.add_argument("--ca-file", help="PEM roots to trust when a proxy intercepts TLS")
237
+ cli.add_argument("--out", help="file to write; stdout when omitted")
238
+ opts = cli.parse_args()
239
+
240
+ file_key = opts.file
241
+ nodes = [piece for piece in (opts.nodes or "").split(",") if piece.strip()]
242
+ if opts.mapping:
243
+ mapping = read_json(opts.mapping)
244
+ file_key = file_key or mapping.get("figmaFileKey")
245
+ nodes = nodes or list(mapping.get("figmaNodes") or [])
246
+
247
+ source, found, files, audited = pick_source(opts, cli, file_key, nodes)
248
+
249
+ first_seen = {}
250
+ for item in found:
251
+ first_seen.setdefault(item["nodeId"], item)
252
+ unique = list(first_seen.values())
253
+
254
+ def having(lang):
255
+ return sum(1 for entry in unique if entry[lang])
256
+
257
+ result = {
258
+ "generatedAt": datetime.now(timezone.utc).isoformat(),
319
259
  "source": source,
320
260
  "files": files,
321
- "auditedNodes": [canon_id(n) for n in node_ids],
322
- "count": len(deduped),
323
- "withTr": sum(1 for a in deduped if a.get("tr") is not None),
324
- "withEn": sum(1 for a in deduped if a.get("en") is not None),
325
- "annotations": deduped,
261
+ "auditedNodes": audited,
262
+ "count": len(unique),
263
+ "withTr": having("tr"),
264
+ "withEn": having("en"),
265
+ "annotations": unique,
326
266
  }
327
-
328
- text = json.dumps(out, ensure_ascii=False, indent=2)
329
- if args.out:
330
- with open(args.out, "w", encoding="utf-8") as fh:
331
- fh.write(text + "\n")
332
- sys.stderr.write(f"# {out['count']} annotated node(s) "
333
- f"(tr={out['withTr']} en={out['withEn']}, source={source}) → {args.out}\n")
267
+ text = json.dumps(result, indent=2, ensure_ascii=False) + "\n"
268
+ if not opts.out:
269
+ sys.stdout.write(text)
334
270
  else:
335
- sys.stdout.write(text + "\n")
336
-
337
- only_tr = [a["nodeId"] for a in deduped if a.get("tr") and not a.get("en")]
338
- if only_tr:
339
- sys.stderr.write(f"# {len(only_tr)} annotation(s) have TR but no EN "
340
- "(flag back to the content team): " + ", ".join(only_tr) + "\n")
271
+ with open(opts.out, "w", encoding="utf-8") as sink:
272
+ sink.write(text)
273
+ print(f"# {result['count']} annotations ({result['withTr']} TR, {result['withEn']} EN) from {source} -> {opts.out}", file=sys.stderr)
274
+
275
+ missing_en = [entry["nodeId"] for entry in unique if entry["tr"] and not entry["en"]]
276
+ if missing_en:
277
+ print(f"# {len(missing_en)} annotation(s) carry TR copy without EN; return them to the content team:", file=sys.stderr)
278
+ for node_id in missing_en:
279
+ print(f"# {node_id}", file=sys.stderr)
341
280
 
342
281
 
343
282
  if __name__ == "__main__":