@mmerterden/multi-agent-pipeline 11.1.0 → 11.3.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 (342) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +2 -2
  3. package/docs/FIGMA_PIPELINE.md +12 -25
  4. package/docs/architecture.md +3 -5
  5. package/docs/features.md +8 -8
  6. package/install/_common.mjs +9 -1
  7. package/install/_dev-only-files.mjs +0 -6
  8. package/install/claude.mjs +45 -18
  9. package/install/copilot.mjs +16 -14
  10. package/install/templates/copilot-instructions.md +3 -3
  11. package/package.json +1 -1
  12. package/pipeline/commands/{multi-agent.md → multi-agent/SKILL.md} +39 -39
  13. package/pipeline/commands/multi-agent/{analysis.md → analysis/SKILL.md} +18 -18
  14. package/pipeline/commands/multi-agent/{analysis-resolve.md → analysis-resolve/SKILL.md} +4 -4
  15. package/pipeline/commands/multi-agent/{autopilot.md → autopilot/SKILL.md} +4 -4
  16. package/pipeline/commands/multi-agent/{build-optimize.md → build-optimize/SKILL.md} +1 -1
  17. package/pipeline/commands/multi-agent/{channels.md → channels/SKILL.md} +12 -12
  18. package/pipeline/commands/multi-agent/{dev.md → dev/SKILL.md} +4 -4
  19. package/pipeline/commands/multi-agent/{dev-autopilot.md → dev-autopilot/SKILL.md} +4 -4
  20. package/pipeline/commands/multi-agent/{dev-local.md → dev-local/SKILL.md} +5 -5
  21. package/pipeline/commands/multi-agent/{dev-local-autopilot.md → dev-local-autopilot/SKILL.md} +4 -4
  22. package/pipeline/commands/multi-agent/{finish.md → finish/SKILL.md} +6 -6
  23. package/pipeline/commands/multi-agent/{generate.md → generate/SKILL.md} +3 -3
  24. package/pipeline/commands/multi-agent/{help.md → help/SKILL.md} +4 -4
  25. package/pipeline/commands/multi-agent/{local.md → local/SKILL.md} +5 -5
  26. package/pipeline/commands/multi-agent/{local-autopilot.md → local-autopilot/SKILL.md} +5 -5
  27. package/pipeline/commands/multi-agent/{manual-test.md → manual-test/SKILL.md} +1 -1
  28. package/pipeline/commands/multi-agent/refactor/SKILL.md +257 -0
  29. package/pipeline/commands/multi-agent/{resume.md → resume/SKILL.md} +1 -1
  30. package/pipeline/commands/multi-agent/{review.md → review/SKILL.md} +5 -5
  31. package/pipeline/commands/multi-agent/{setup.md → setup/SKILL.md} +1 -1
  32. package/pipeline/commands/multi-agent/{sync.md → sync/SKILL.md} +20 -58
  33. package/pipeline/{commands/multi-agent → multi-agent-refs}/_account-picker.md +2 -2
  34. package/pipeline/{commands/multi-agent → multi-agent-refs}/_dev-context.md +2 -2
  35. package/pipeline/{commands/multi-agent → multi-agent-refs}/_repo-picker.md +2 -2
  36. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/android-guide.md +1 -1
  37. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/channels/jira.md +1 -1
  38. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/channels/wiki.md +7 -7
  39. package/pipeline/multi-agent-refs/component-dispatch.md +92 -0
  40. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/cross-cli-contract.md +10 -77
  41. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/features/verify-by-test.md +1 -1
  42. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/generate-issue.md +2 -2
  43. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/issue-jira-triad.md +1 -1
  44. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/keychain.md +1 -1
  45. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/phases/log-format.md +1 -1
  46. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/phases/modes.md +2 -2
  47. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/phases/operations.md +1 -1
  48. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/phases/phase-0-init.md +10 -10
  49. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/phases/phase-1-analysis.md +6 -6
  50. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/phases/phase-2-planning.md +3 -3
  51. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/phases/phase-3-dev.md +10 -10
  52. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/phases/phase-4-review.md +8 -8
  53. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/phases/phase-5-test.md +3 -3
  54. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/phases/phase-6-commit.md +4 -4
  55. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/phases/phase-7-report.md +6 -6
  56. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/phases.md +12 -12
  57. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/progress-contract.md +4 -4
  58. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/swiftui-guide.md +1 -1
  59. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/tracker-contract.md +3 -3
  60. package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/wiki-capture.md +4 -4
  61. package/pipeline/preferences-template.json +17 -1
  62. package/pipeline/rules/figma-pipeline.md +2 -2
  63. package/pipeline/schemas/prefs.schema.json +0 -34
  64. package/pipeline/scripts/README.md +1 -3
  65. package/pipeline/scripts/build-stack-plugins.mjs +1 -1
  66. package/pipeline/scripts/fixtures/install-layout.tsv +6 -5
  67. package/pipeline/scripts/gen-mode-dispatch.mjs +3 -3
  68. package/pipeline/scripts/phase-banner.sh +2 -2
  69. package/pipeline/scripts/review-scope.mjs +94 -0
  70. package/pipeline/scripts/scan-agent-config.sh +2 -2
  71. package/pipeline/scripts/smoke-agent-log-cost.sh +1 -1
  72. package/pipeline/scripts/smoke-agent-model-routing.sh +4 -4
  73. package/pipeline/scripts/smoke-autopilot-circuit-breaker.sh +2 -2
  74. package/pipeline/scripts/smoke-channels-approval-gate.sh +2 -2
  75. package/pipeline/scripts/smoke-channels-flow.sh +5 -5
  76. package/pipeline/scripts/smoke-clarify.sh +1 -1
  77. package/pipeline/scripts/smoke-commands-skills-parity.sh +3 -3
  78. package/pipeline/scripts/smoke-community-gates.sh +1 -1
  79. package/pipeline/scripts/smoke-compliance-skills.sh +2 -2
  80. package/pipeline/scripts/smoke-cost-summary.sh +1 -1
  81. package/pipeline/scripts/smoke-cross-cli-behavior.sh +17 -43
  82. package/pipeline/scripts/smoke-cross-phase-cohesion.sh +1 -1
  83. package/pipeline/scripts/smoke-dev-critic.sh +1 -1
  84. package/pipeline/scripts/smoke-diff-explain.sh +1 -1
  85. package/pipeline/scripts/smoke-diff-risk.sh +1 -1
  86. package/pipeline/scripts/smoke-evidence-gate.sh +1 -1
  87. package/pipeline/scripts/smoke-figma-dispatch.sh +46 -57
  88. package/pipeline/scripts/smoke-gate-hooks.sh +1 -1
  89. package/pipeline/scripts/smoke-generate-issue.sh +8 -8
  90. package/pipeline/scripts/smoke-handoff-contract.sh +3 -3
  91. package/pipeline/scripts/smoke-identity-isolation.sh +2 -2
  92. package/pipeline/scripts/smoke-intent-guard.sh +1 -1
  93. package/pipeline/scripts/smoke-issue-comment-template.sh +2 -2
  94. package/pipeline/scripts/smoke-issue-jira-triad.sh +4 -4
  95. package/pipeline/scripts/smoke-language-axis.sh +6 -6
  96. package/pipeline/scripts/smoke-learnings-ledger.sh +3 -3
  97. package/pipeline/scripts/smoke-mode-dispatch-drift.sh +16 -16
  98. package/pipeline/scripts/smoke-model-fallback.sh +3 -3
  99. package/pipeline/scripts/smoke-multi-repo-integration.sh +2 -2
  100. package/pipeline/scripts/smoke-multi-repo-worktree.sh +1 -1
  101. package/pipeline/scripts/smoke-no-token-prompt.sh +5 -5
  102. package/pipeline/scripts/smoke-phase-0-multi-repo.sh +1 -1
  103. package/pipeline/scripts/smoke-phase-6-multi.sh +1 -1
  104. package/pipeline/scripts/smoke-phase4-gates.sh +45 -0
  105. package/pipeline/scripts/smoke-plan-approval-gate.sh +5 -5
  106. package/pipeline/scripts/smoke-plan-todos.sh +3 -3
  107. package/pipeline/scripts/smoke-pr-review-actions.sh +3 -3
  108. package/pipeline/scripts/smoke-prefs-language.sh +1 -1
  109. package/pipeline/scripts/smoke-progress-contract.sh +2 -2
  110. package/pipeline/scripts/smoke-push-retry.sh +1 -1
  111. package/pipeline/scripts/smoke-repo-map.sh +2 -2
  112. package/pipeline/scripts/smoke-shadow-git.sh +1 -1
  113. package/pipeline/scripts/smoke-skill-authoring.sh +4 -9
  114. package/pipeline/scripts/smoke-tasklist-ordering.sh +10 -10
  115. package/pipeline/scripts/smoke-test-gap.sh +1 -1
  116. package/pipeline/scripts/smoke-token-budget.sh +1 -1
  117. package/pipeline/scripts/smoke-token-preflight.sh +2 -2
  118. package/pipeline/scripts/smoke-tracker-contract.sh +13 -13
  119. package/pipeline/scripts/smoke-tracker-tokens-invocation.sh +5 -5
  120. package/pipeline/scripts/smoke-triage-memory.sh +2 -2
  121. package/pipeline/scripts/smoke-update-check.sh +1 -1
  122. package/pipeline/scripts/smoke-url-enrichment.sh +2 -2
  123. package/pipeline/scripts/smoke-validator-gates.sh +1 -1
  124. package/pipeline/scripts/smoke-verify-by-test.sh +3 -3
  125. package/pipeline/scripts/smoke-wiki-integration.sh +9 -33
  126. package/pipeline/scripts/smoke-work-summary.sh +1 -1
  127. package/pipeline/scripts/smoke-worktree-path-convention.sh +4 -4
  128. package/pipeline/scripts/test-integrity-gate.mjs +83 -0
  129. package/pipeline/scripts/uninstall.mjs +2 -2
  130. package/pipeline/skills/.skill-manifest.json +40 -160
  131. package/pipeline/skills/.skills-index.json +21 -372
  132. package/pipeline/skills/shared/README.md +1 -1
  133. package/pipeline/skills/shared/core/multi-agent/SKILL.md +1 -1
  134. package/pipeline/skills/shared/core/multi-agent-analysis/SKILL.md +2 -2
  135. package/pipeline/skills/shared/core/multi-agent-analysis-resolve/SKILL.md +3 -3
  136. package/pipeline/skills/shared/core/multi-agent-build-optimize/SKILL.md +1 -1
  137. package/pipeline/skills/shared/core/multi-agent-channels/SKILL.md +1 -1
  138. package/pipeline/skills/shared/core/multi-agent-finish/SKILL.md +1 -1
  139. package/pipeline/skills/shared/core/multi-agent-help/SKILL.md +1 -1
  140. package/pipeline/skills/shared/core/multi-agent-refactor/SKILL.md +116 -51
  141. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +8 -30
  142. package/pipeline/skills/shared/external/backlog/BACKLOG.md +32 -0
  143. package/pipeline/skills/shared/external/backlog/SKILL.md +49 -0
  144. package/pipeline/skills/shared/external/compose-components/SKILL.md +14 -14
  145. package/pipeline/skills/shared/external/skill-creator/SKILL.md +48 -0
  146. package/pipeline/skills/shared/external/skill-creator/audit.md +59 -0
  147. package/pipeline/skills/shared/external/skill-creator/checklist.md +32 -0
  148. package/pipeline/skills/shared/external/skill-creator/examples.md +65 -0
  149. package/pipeline/skills/shared/external/skill-creator/label-check.md +43 -0
  150. package/pipeline/skills/shared/external/skill-creator/scripts/audit-panel.js +83 -0
  151. package/pipeline/skills/shared/external/skill-creator/template.md +67 -0
  152. package/pipeline/skills/skills-index.md +4 -43
  153. package/pipeline/commands/multi-agent/refactor.md +0 -188
  154. package/pipeline/commands/multi-agent/refs/component-dispatch.md +0 -92
  155. package/pipeline/scripts/smoke-existing-discovery-gate.sh +0 -71
  156. package/pipeline/scripts/smoke-figma-android-parity.sh +0 -148
  157. package/pipeline/scripts/smoke-figma-credential-store.sh +0 -105
  158. package/pipeline/scripts/smoke-figma-cross-cli-inventory.sh +0 -177
  159. package/pipeline/scripts/smoke-figma-sync.sh +0 -149
  160. package/pipeline/scripts/smoke-sync-delegation.sh +0 -74
  161. package/pipeline/skills/figma-android/README.md +0 -38
  162. package/pipeline/skills/figma-android/figma-component-code-connect/SKILL.md +0 -62
  163. package/pipeline/skills/figma-android/figma-component-implement/SKILL.md +0 -158
  164. package/pipeline/skills/figma-android/figma-component-test/SKILL.md +0 -120
  165. package/pipeline/skills/figma-android/figma-component-wiki/SKILL.md +0 -35
  166. package/pipeline/skills/figma-android/figma-to-component/SKILL.md +0 -124
  167. package/pipeline/skills/figma-common/README.md +0 -64
  168. package/pipeline/skills/figma-common/figma-bottom-sheets/SKILL.md +0 -152
  169. package/pipeline/skills/figma-common/figma-cli-iterate/SKILL.md +0 -282
  170. package/pipeline/skills/figma-common/figma-cli-iterate-mend/SKILL.md +0 -503
  171. package/pipeline/skills/figma-common/figma-cli-lean-iterate/SKILL.md +0 -288
  172. package/pipeline/skills/figma-common/figma-cli-skip/SKILL.md +0 -362
  173. package/pipeline/skills/figma-common/figma-commit/COMMON_REBASE.md +0 -206
  174. package/pipeline/skills/figma-common/figma-commit/REVIEW.md +0 -337
  175. package/pipeline/skills/figma-common/figma-commit/SKILL.md +0 -216
  176. package/pipeline/skills/figma-common/figma-component-confluence-sync/SKILL.md +0 -223
  177. package/pipeline/skills/figma-common/figma-component-start/SKILL.md +0 -251
  178. package/pipeline/skills/figma-common/figma-component-status-update/SKILL.md +0 -78
  179. package/pipeline/skills/figma-common/figma-evolve-component/SKILL.md +0 -61
  180. package/pipeline/skills/figma-common/figma-fix/SKILL.md +0 -321
  181. package/pipeline/skills/figma-common/figma-form-integration/SKILL.md +0 -542
  182. package/pipeline/skills/figma-common/figma-issue/SKILL.md +0 -750
  183. package/pipeline/skills/figma-common/figma-iterate/SKILL.md +0 -208
  184. package/pipeline/skills/figma-common/figma-iteration-commit/SKILL.md +0 -1020
  185. package/pipeline/skills/figma-common/figma-mend/SKILL.md +0 -331
  186. package/pipeline/skills/figma-common/figma-navigation/SKILL.md +0 -156
  187. package/pipeline/skills/figma-common/figma-overlays/SKILL.md +0 -142
  188. package/pipeline/skills/figma-common/figma-price-integration/SKILL.md +0 -398
  189. package/pipeline/skills/figma-common/figma-remote-mcp-auth/SKILL.md +0 -104
  190. package/pipeline/skills/figma-common/figma-review/SKILL.md +0 -400
  191. package/pipeline/skills/figma-common/figma-setup/SKILL.md +0 -514
  192. package/pipeline/skills/figma-common/figma-setup/scripts/fetch-mcp-token.py +0 -592
  193. package/pipeline/skills/figma-common/figma-skip/SKILL.md +0 -129
  194. package/pipeline/skills/figma-common/figma-ui-patterns/SKILL.md +0 -105
  195. package/pipeline/skills/figma-common/figma-ui-patterns/patterns/animated-gradient-border.md +0 -116
  196. package/pipeline/skills/figma-common/figma-utility/SKILL.md +0 -274
  197. package/pipeline/skills/figma-common/figma-utility/scripts/figma-utility.py +0 -808
  198. package/pipeline/skills/figma-common/figma-validate/SKILL.md +0 -633
  199. package/pipeline/skills/figma-common/performance-iteration-commit-all/SKILL.md +0 -716
  200. package/pipeline/skills/figma-common/performance-review-next/SKILL.md +0 -238
  201. package/pipeline/skills/figma-common/performance-start/SKILL.md +0 -430
  202. package/pipeline/skills/figma-common/performance-swiftui/SKILL.md +0 -706
  203. package/pipeline/skills/figma-common/performance-tour/SKILL.md +0 -423
  204. package/pipeline/skills/figma-ios/REVIEW_CHECKLIST.md +0 -67
  205. package/pipeline/skills/figma-ios/figma-component-code-connect/SKILL.md +0 -178
  206. package/pipeline/skills/figma-ios/figma-component-implement/SKILL.md +0 -184
  207. package/pipeline/skills/figma-ios/figma-component-test/SKILL.md +0 -219
  208. package/pipeline/skills/figma-ios/figma-component-wiki/SKILL.md +0 -274
  209. package/pipeline/skills/figma-ios/figma-to-component/SKILL.md +0 -416
  210. package/pipeline/skills/figma-ios/figma-to-component/halt-return-protocol.md +0 -57
  211. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-0-init.md +0 -307
  212. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-1-gathering.md +0 -119
  213. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-1.5-existing-discovery.md +0 -174
  214. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-2-orchestrator.md +0 -333
  215. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-2a-testing-identifiers.md +0 -368
  216. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-2b-localization.md +0 -393
  217. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-2c-accessibility.md +0 -617
  218. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-2d-analytics.md +0 -352
  219. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-3-orchestrator.md +0 -337
  220. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-3a-location.md +0 -206
  221. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-3b-tokens.md +0 -235
  222. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-3c-nested.md +0 -214
  223. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-3d-patterns.md +0 -902
  224. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-3e-assets.md +0 -156
  225. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-3f-utilities.md +0 -175
  226. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-3g-property-coverage.md +0 -176
  227. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-3h-variant-config.md +0 -333
  228. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-4-orchestrator.md +0 -412
  229. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-4a-configuration.md +0 -336
  230. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-4b-view.md +0 -705
  231. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-4c-documentation.md +0 -332
  232. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-4d-preview.md +0 -380
  233. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-4e-modifiers.md +0 -262
  234. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-5-orchestrator.md +0 -482
  235. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-5a-viewinspector.md +0 -274
  236. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-5b-snapshot.md +0 -636
  237. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-5c-unit.md +0 -142
  238. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-6-code-connect.md +0 -547
  239. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-7-wiki.md +0 -39
  240. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-7a-confluence-generate.md +0 -659
  241. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-7a-wiki-generate.md +0 -580
  242. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-8-cleanup.md +0 -51
  243. package/pipeline/skills/figma-ios/figma-to-component/reference/accessibility.md +0 -183
  244. package/pipeline/skills/figma-ios/figma-to-component/reference/analytics-events.md +0 -64
  245. package/pipeline/skills/figma-ios/figma-to-component/reference/code-connect.md +0 -531
  246. package/pipeline/skills/figma-ios/figma-to-component/reference/confluence-api.md +0 -89
  247. package/pipeline/skills/figma-ios/figma-to-component/reference/confluence-xhtml.md +0 -155
  248. package/pipeline/skills/figma-ios/figma-to-component/reference/figma-to-swiftui-effects.md +0 -196
  249. package/pipeline/skills/figma-ios/figma-to-component/reference/halt-return-protocol.md +0 -57
  250. package/pipeline/skills/figma-ios/figma-to-component/reference/localization-naming.md +0 -89
  251. package/pipeline/skills/figma-ios/figma-to-component/reference/macros.md +0 -227
  252. package/pipeline/skills/figma-ios/figma-to-component/reference/missing-tokens.md +0 -157
  253. package/pipeline/skills/figma-ios/figma-to-component/reference/orchestrator-discipline.md +0 -90
  254. package/pipeline/skills/figma-ios/figma-to-component/reference/registry.md +0 -116
  255. package/pipeline/skills/figma-ios/figma-to-component/reference/remote-mcp-script.md +0 -153
  256. package/pipeline/skills/figma-ios/figma-to-component/reference/rest-api-script.md +0 -130
  257. package/pipeline/skills/figma-ios/figma-to-component/reference/scripts-inventory.md +0 -218
  258. package/pipeline/skills/figma-ios/figma-to-component/reference/snapshot-testing.md +0 -188
  259. package/pipeline/skills/figma-ios/figma-to-component/reference/subcomponent-graph.md +0 -93
  260. package/pipeline/skills/figma-ios/figma-to-component/reference/testing-identifiers-naming.md +0 -98
  261. package/pipeline/skills/figma-ios/figma-to-component/reference/tools.md +0 -261
  262. package/pipeline/skills/figma-ios/figma-to-component/reference/viewinspector.md +0 -147
  263. package/pipeline/skills/figma-ios/figma-to-component/reference/wiki-to-confluence-mapping.md +0 -182
  264. package/pipeline/skills/figma-ios/figma-to-component/scripts/apply-author-login-map.py +0 -185
  265. package/pipeline/skills/figma-ios/figma-to-component/scripts/backfill-status.py +0 -609
  266. package/pipeline/skills/figma-ios/figma-to-component/scripts/build-author-registry.py +0 -332
  267. package/pipeline/skills/figma-ios/figma-to-component/scripts/bulk-sync-issues.py +0 -261
  268. package/pipeline/skills/figma-ios/figma-to-component/scripts/code-connect-data-gather.py +0 -184
  269. package/pipeline/skills/figma-ios/figma-to-component/scripts/code-connect-publish.sh +0 -188
  270. package/pipeline/skills/figma-ios/figma-to-component/scripts/confluence-component-status-upload.py +0 -768
  271. package/pipeline/skills/figma-ios/figma-to-component/scripts/confluence-component-status.py +0 -191
  272. package/pipeline/skills/figma-ios/figma-to-component/scripts/confluence-data-gather.py +0 -420
  273. package/pipeline/skills/figma-ios/figma-to-component/scripts/confluence-page-ids.example.json +0 -9
  274. package/pipeline/skills/figma-ios/figma-to-component/scripts/confluence-publish.py +0 -336
  275. package/pipeline/skills/figma-ios/figma-to-component/scripts/figma-subcomponent-graph.py +0 -391
  276. package/pipeline/skills/figma-ios/figma-to-component/scripts/figma-update.py +0 -292
  277. package/pipeline/skills/figma-ios/figma-to-component/scripts/lib/__init__.py +0 -1
  278. package/pipeline/skills/figma-ios/figma-to-component/scripts/lib/issue_sync_propagate.py +0 -93
  279. package/pipeline/skills/figma-ios/figma-to-component/scripts/lib/registry_writer.py +0 -299
  280. package/pipeline/skills/figma-ios/figma-to-component/scripts/lib/test_backfill_status.py +0 -343
  281. package/pipeline/skills/figma-ios/figma-to-component/scripts/lib/test_figma_update.py +0 -206
  282. package/pipeline/skills/figma-ios/figma-to-component/scripts/lib/test_figma_update_http.py +0 -149
  283. package/pipeline/skills/figma-ios/figma-to-component/scripts/lib/test_phase_clis.py +0 -281
  284. package/pipeline/skills/figma-ios/figma-to-component/scripts/lib/test_registry_writer.py +0 -332
  285. package/pipeline/skills/figma-ios/figma-to-component/scripts/lib/test_skill_figma_issue.py +0 -176
  286. package/pipeline/skills/figma-ios/figma-to-component/scripts/lib/test_skill_figma_review.py +0 -98
  287. package/pipeline/skills/figma-ios/figma-to-component/scripts/lib/test_update_issue.py +0 -298
  288. package/pipeline/skills/figma-ios/figma-to-component/scripts/lib/test_update_issue_gh.py +0 -195
  289. package/pipeline/skills/figma-ios/figma-to-component/scripts/phase1-gather.py +0 -1298
  290. package/pipeline/skills/figma-ios/figma-to-component/scripts/phase2-finalize.py +0 -228
  291. package/pipeline/skills/figma-ios/figma-to-component/scripts/phase3-scripts.py +0 -1089
  292. package/pipeline/skills/figma-ios/figma-to-component/scripts/phase4-finalize.py +0 -141
  293. package/pipeline/skills/figma-ios/figma-to-component/scripts/phase5-finalize.py +0 -106
  294. package/pipeline/skills/figma-ios/figma-to-component/scripts/phase6-finalize.py +0 -162
  295. package/pipeline/skills/figma-ios/figma-to-component/scripts/phase7-finalize.py +0 -105
  296. package/pipeline/skills/figma-ios/figma-to-component/scripts/register-icons-codeconnect.py +0 -179
  297. package/pipeline/skills/figma-ios/figma-to-component/scripts/remote-mcp-fetch.py +0 -260
  298. package/pipeline/skills/figma-ios/figma-to-component/scripts/resolve-author-logins.py +0 -260
  299. package/pipeline/skills/figma-ios/figma-to-component/scripts/run-uicomponents-tests.sh +0 -86
  300. package/pipeline/skills/figma-ios/figma-to-component/scripts/sidebar-generator.py +0 -321
  301. package/pipeline/skills/figma-ios/figma-to-component/scripts/update-issue-from-registry.py +0 -1470
  302. package/pipeline/skills/figma-ios/figma-to-component/scripts/validate-phase4.sh +0 -176
  303. package/pipeline/skills/figma-ios/figma-to-component/scripts/validate-phase6.sh +0 -147
  304. package/pipeline/skills/figma-ios/figma-to-component/scripts/validate-phase7a.py +0 -629
  305. /package/pipeline/commands/multi-agent/{delete.md → delete/SKILL.md} +0 -0
  306. /package/pipeline/commands/multi-agent/{diff-explain.md → diff-explain/SKILL.md} +0 -0
  307. /package/pipeline/commands/multi-agent/{garbage-collect.md → garbage-collect/SKILL.md} +0 -0
  308. /package/pipeline/commands/multi-agent/{issue.md → issue/SKILL.md} +0 -0
  309. /package/pipeline/commands/multi-agent/{jira.md → jira/SKILL.md} +0 -0
  310. /package/pipeline/commands/multi-agent/{kill.md → kill/SKILL.md} +0 -0
  311. /package/pipeline/commands/multi-agent/{language.md → language/SKILL.md} +0 -0
  312. /package/pipeline/commands/multi-agent/{log.md → log/SKILL.md} +0 -0
  313. /package/pipeline/commands/multi-agent/{prune-logs.md → prune-logs/SKILL.md} +0 -0
  314. /package/pipeline/commands/multi-agent/{purge.md → purge/SKILL.md} +0 -0
  315. /package/pipeline/commands/multi-agent/{scan.md → scan/SKILL.md} +0 -0
  316. /package/pipeline/commands/multi-agent/{search.md → search/SKILL.md} +0 -0
  317. /package/pipeline/commands/multi-agent/{stack.md → stack/SKILL.md} +0 -0
  318. /package/pipeline/commands/multi-agent/{status.md → status/SKILL.md} +0 -0
  319. /package/pipeline/commands/multi-agent/{test.md → test/SKILL.md} +0 -0
  320. /package/pipeline/commands/multi-agent/{update.md → update/SKILL.md} +0 -0
  321. /package/pipeline/{commands/multi-agent → multi-agent-refs}/_input-parser.md +0 -0
  322. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/analysis-template.md +0 -0
  323. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/audit-guide.md +0 -0
  324. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/backend-guide.md +0 -0
  325. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/channels/confluence.md +0 -0
  326. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/channels/issue-comment.md +0 -0
  327. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/channels/pr-review-actions.md +0 -0
  328. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/channels/pr.md +0 -0
  329. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/conventions-defaults.md +0 -0
  330. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/features/autopilot-circuit-breaker.md +0 -0
  331. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/features/dev-critic.md +0 -0
  332. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/features/external-context-injection.md +0 -0
  333. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/features/model-fallback.md +0 -0
  334. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/features/plan-todos.md +0 -0
  335. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/features/prior-fix-detection.md +0 -0
  336. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/features/repo-map.md +0 -0
  337. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/features/shadow-git.md +0 -0
  338. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/frontend-guide.md +0 -0
  339. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/knowledge.md +0 -0
  340. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/multi-repo-integration-build.md +0 -0
  341. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/picker-contract.md +0 -0
  342. /package/pipeline/{commands/multi-agent/refs → multi-agent-refs}/rules.md +0 -0
@@ -1,1020 +0,0 @@
1
- ---
2
- name: figma-iteration-commit
3
- description: NEVER create branches on the main repo (REPO_ROOT). Do not create `iteration/develop` or any other branch on the main repo. Do not commit to the main repo.
4
- ---
5
-
6
- # /figma-iteration-commit - Validate & Commit to iteration/develop + PR to develop
7
-
8
- ## Guardrails
9
-
10
- > **NEVER create branches on the main repo (REPO_ROOT).** Do not create `iteration/develop` or any other branch on the main repo. Do not commit to the main repo. This skill only commits to submodules (common, uicomponents, wiki). Main repo submodule refs are updated separately - not by this skill.
11
-
12
- > **NEVER use `json.dumps()` default formatting on JSON files.** When editing JSON files (e.g., `ui-testing-identifiers.json`), preserve the existing file format. Do not reformat, re-indent, or change separators. The canonical format for `ui-testing-identifiers.json` is `" : "` (space-colon-space), not `": "`. If you must write JSON programmatically, post-process the output to match the existing format.
13
-
14
- > **NEVER manually edit `ui-testing-identifiers.json`.** Format corruption on this file is most likely caused by conflict resolution. When a rebase conflict occurs on this file:
15
- > 1. Check what keys we added - look at `Shared/Figma/Components/{nodeId}.json` (has the key list) or `git show HEAD:Shared/UITestingIdentifiers/ui-testing-identifiers.json`
16
- > 2. Take the remote version: `git checkout --ours Shared/UITestingIdentifiers/ui-testing-identifiers.json` (during rebase, `--ours` = upstream/remote)
17
- > 3. Re-add our keys via `/common-utility` (`utility-add-key`) - this writes in the correct `" : "` format
18
- > 4. `git add Shared/UITestingIdentifiers/ui-testing-identifiers.json` + `git rebase --continue`
19
- >
20
- > Never resolve JSON conflicts by hand-editing or `json.dumps()` - it reformats the entire file.
21
-
22
- > **ALWAYS validate `ui-testing-identifiers.json` key count after every rebase - even when there were no conflicts.** The implement agent regenerates this file from `identifier-keys.json` only, which means an auto-merge can silently drop keys that exist on `iteration/develop` but not in the local metadata. After every rebase (or cherry-pick), before staging and continuing, run:
23
- >
24
- > ```bash
25
- > REMOTE_KEY_COUNT=$(git show origin/iteration/develop:Shared/UITestingIdentifiers/ui-testing-identifiers.json 2>/dev/null | grep -c '".*" : "' || echo 0)
26
- > LOCAL_KEY_COUNT=$(grep -c '".*" : "' Shared/UITestingIdentifiers/ui-testing-identifiers.json 2>/dev/null || echo 0)
27
- > if [ "$LOCAL_KEY_COUNT" -lt "$REMOTE_KEY_COUNT" ]; then
28
- > echo "⚠️ INTEGRITY VIOLATION: ui-testing-identifiers.json lost $((REMOTE_KEY_COUNT - LOCAL_KEY_COUNT)) keys vs origin/iteration/develop"
29
- > echo " Remote: ${REMOTE_KEY_COUNT} keys, Local: ${LOCAL_KEY_COUNT} keys"
30
- > echo " Restoring from origin/iteration/develop and re-adding component keys..."
31
- > git show origin/iteration/develop:Shared/UITestingIdentifiers/ui-testing-identifiers.json \
32
- > > Shared/UITestingIdentifiers/ui-testing-identifiers.json
33
- > # Re-add our component's keys (they are in identifier-keys.json - tool will merge them in)
34
- > .build/debug/UITestingIdentifierTool generate \
35
- > --config Shared/UITestingIdentifiers/Config/identifier-config.json
36
- > git add Shared/UITestingIdentifiers/ui-testing-identifiers.json
37
- > git add iOS/Sources/UITestingIdentifiers/Generated/UITestingIdentifierKeys.swift
38
- > fi
39
- > ```
40
- >
41
- > This guard runs even when `ui-testing-identifiers.json` was NOT in the conflict list. Silent key loss from auto-merge is the most common failure mode.
42
-
43
- > **ALWAYS validate Generated Swift key files after every rebase - even when there were no conflicts.** The codegen tool (`UnifiedCodeGenerationTool`) regenerates `LocalizationStringKeys.swift` and `LocalizedAccessibilityStringKeys.swift` from config JSONs that reference `Sources/Suggested/*.json` files. An auto-merge (or accepting either side during conflict resolution) can silently drop enum blocks if the suggested-key files from another developer's component are not present locally. After every rebase (or cherry-pick), before rebuilding, run:
44
- >
45
- > ```bash
46
- > LOC_FILE="iOS/Sources/LocalizationStringKeys/Generated/LocalizationStringKeys.swift"
47
- > A11Y_FILE="iOS/Sources/AccessibilityStringKeys/Generated/LocalizedAccessibilityStringKeys.swift"
48
- > for GEN_FILE in "$LOC_FILE" "$A11Y_FILE"; do
49
- > REMOTE_ENUMS=$(git show origin/iteration/develop:"${GEN_FILE}" 2>/dev/null | grep -oE 'enum [A-Za-z0-9_]+' | sort -u || true)
50
- > LOCAL_ENUMS=$(grep -oE 'enum [A-Za-z0-9_]+' "${GEN_FILE}" 2>/dev/null | sort -u || true)
51
- > MISSING=$(comm -23 <(echo "$REMOTE_ENUMS") <(echo "$LOCAL_ENUMS"))
52
- > if [ -n "$MISSING" ]; then
53
- > echo "⚠️ INTEGRITY VIOLATION: ${GEN_FILE##*/} lost enum blocks vs origin/iteration/develop:"
54
- > echo "$MISSING"
55
- > echo " Restoring remote version (rebuild will re-add our component's keys)..."
56
- > git show origin/iteration/develop:"${GEN_FILE}" > "${GEN_FILE}"
57
- > git add "${GEN_FILE}"
58
- > fi
59
- > done
60
- > ```
61
- >
62
- > This guard runs even when the Generated files were NOT in the conflict list. Silent enum loss from auto-merge or "accept either side" resolution is a known failure mode - the rebuild script's codegen step (3.5) will re-add our component's keys on top of the restored remote file.
63
-
64
- > **ALWAYS validate `Sources/Suggested/*.json` file count after every rebase, cherry-pick, AND before every commit - even when there were no conflicts.** The implement agent only creates source JSONs for the current component. A rebase, cherry-pick, or `git add -A` can silently drop source JSON files belonging to OTHER components (e.g., a tool run deletes files, or a workspace reset loses them). These per-key source files are the ground truth for localization and accessibility code generation - losing them means generated code silently loses keys for other components. After every rebase (or cherry-pick), AND before every `git add -A` in the commit step, run:
65
- >
66
- > ```bash
67
- > for SUGGESTED_DIR in \
68
- > "Shared/Localization/LocalizationStrings/Sources/Suggested" \
69
- > "Shared/Localization/AccessibilityStrings/Sources/Suggested"; do
70
- >
71
- > REMOTE_FILES=$(git ls-tree --name-only origin/iteration/develop -- "${SUGGESTED_DIR}/" 2>/dev/null | sed "s|${SUGGESTED_DIR}/||" | sort)
72
- > LOCAL_FILES=$(ls -1 "${SUGGESTED_DIR}/" 2>/dev/null | sort)
73
- > MISSING_FILES=$(comm -23 <(echo "$REMOTE_FILES") <(echo "$LOCAL_FILES"))
74
- >
75
- > if [ -n "$MISSING_FILES" ]; then
76
- > MISSING_COUNT=$(echo "$MISSING_FILES" | wc -l | tr -d ' ')
77
- > echo "⚠️ INTEGRITY VIOLATION: ${SUGGESTED_DIR} lost ${MISSING_COUNT} source JSON file(s) vs origin/iteration/develop:"
78
- > echo "$MISSING_FILES" | head -20
79
- > echo " Restoring missing files from origin/iteration/develop..."
80
- > while IFS= read -r FILE; do
81
- > git show "origin/iteration/develop:${SUGGESTED_DIR}/${FILE}" > "${SUGGESTED_DIR}/${FILE}"
82
- > git add "${SUGGESTED_DIR}/${FILE}"
83
- > done <<< "$MISSING_FILES"
84
- > echo "✅ Restored ${MISSING_COUNT} missing source JSON file(s) in ${SUGGESTED_DIR##*/}."
85
- > fi
86
- > done
87
- > ```
88
- >
89
- > This guard catches the most dangerous form of silent data loss: source JSON files from OTHER components being deleted by the current component's pipeline. Unlike generated files (which can be rebuilt), source JSONs contain the original translations and cannot be re-derived.
90
-
91
- > **NEVER call `common-rebuild-derived-artifacts.sh` blindly after conflict resolution when `ui-testing-identifiers.json` may have been touched.** The rebuild script calls `UITestingIdentifierTool generate --swift-only` which only writes the Swift file - but the JSON may already be corrupt from a bad auto-merge. Always run the key-count integrity check BEFORE the rebuild script, and fix the JSON FIRST if the count decreased.
92
-
93
- ## Conflict File Classification (common submodule)
94
-
95
- When a cherry-pick or rebase conflict occurs in the common submodule, classify each conflicted file and resolve automatically by pattern:
96
-
97
- | File Pattern | Strategy | Reason |
98
- |-------------|----------|--------|
99
- | `iOS/Sources/*/Generated/*` | Accept either side | Will regenerate |
100
- | `Shared/Figma/Generated/*` | Accept either side | Gitignored, will regenerate |
101
- | `iOS/Sources/LocalizationAssets/Resources/*.xcstrings` | Accept either side | Will regenerate |
102
- | `iOS/Sources/AccessibilityAssets/Resources/*.xcstrings` | Accept either side | Will regenerate |
103
- | `Shared/Localization/*/Metadata/*` | Accept either side | Gitignored, will regenerate |
104
- | `Shared/UITestingIdentifiers/Metadata/*` | Accept either side | Gitignored, will regenerate |
105
- | `Sources/Suggested/*.json` | Our version wins | Per-key files, we created them |
106
- | `Shared/Figma/Components/*.json` | Our version wins | We created/modified it |
107
- | `Shared/UITestingIdentifiers/ui-testing-identifiers.json` | Take remote + re-add keys via tool | See Guardrails - never hand-edit |
108
- | `Shared/UIAssets/Colors/*.json` | Take remote + manually insert new entries | Match existing format exactly |
109
-
110
- **After resolving all conflicts, ALWAYS rebuild derived artifacts:**
111
-
112
- ```bash
113
- bash "${REPO_ROOT}/.instructions/common/scripts/common-rebuild-derived-artifacts.sh"
114
- ```
115
-
116
- This regenerates all merged data, metadata, keys indexes, UI assets, token registries, and Figma catalogs.
117
-
118
- ---
119
-
120
- ## Purpose
121
-
122
- Validates a component implementation, commits directly to `iteration/develop` in submodules, and handles issue housekeeping (comment, phase update, auto-unblock dependents).
123
-
124
- ## Parameters
125
-
126
- | Parameter | Required | Default | Description |
127
- |-----------|----------|---------|-------------|
128
- | `<ComponentName>` | Yes | - | PascalCase component name |
129
- | `--gh` | No | - | GitHub issue number (auto-detected if on a tracked issue) |
130
-
131
- ```
132
- /figma-iteration-commit ModalsTitle
133
- /figma-iteration-commit ModalsTitle --gh 107
134
- ```
135
-
136
- ---
137
-
138
- ## Constants
139
-
140
- ```
141
- REPO_ROOT = git repo root (auto-detect)
142
- GH_REPO = {github.componentsRepo}
143
- MAIN_REPO = ${REPO_ROOT}
144
- COMMON = ${REPO_ROOT}/{repos.common.path}
145
- UICOMPONENTS = ${REPO_ROOT}/{repos.components.path}
146
- WIKI = ${REPO_ROOT}/{repos.wiki.path}
147
- DEFAULT_JIRA = {jira.projectKey}-124692
148
- ```
149
-
150
- ---
151
-
152
- ## STEP 0 - Resolve
153
-
154
- 1. Parse `ComponentName`. Convert to kebab-case.
155
- 2. If `--gh` provided, read the issue to get Jira key. Otherwise search for the issue:
156
- ```bash
157
- gh issue list --repo ${GH_REPO} --state open --label component --search "{ComponentName}" --json number,body --jq '.[0]'
158
- ```
159
- 3. Extract Jira key from issue body (or use `DEFAULT_JIRA`).
160
- 4. Ensure submodules are on `iteration/develop`. For each submodule (common, uicomponents):
161
-
162
- **If already on `iteration/develop`** → continue.
163
-
164
- **If on a feature branch with commits** → rebase onto `iteration/develop` with backup:
165
-
166
- ```
167
- a. Record the feature branch name and HEAD SHA
168
- b. Create a backup branch: backup/{feature-branch-name}
169
- c. Fetch latest iteration/develop from origin
170
- d. Checkout iteration/develop
171
- e. Cherry-pick (or rebase) the feature branch commits onto iteration/develop
172
- f. Run build (STEP 1a) to verify nothing broke after rebase
173
- g. If build succeeds:
174
- - Delete the local feature branch
175
- - Delete the remote feature branch (origin)
176
- - Delete the local backup branch
177
- h. If build fails:
178
- - Reset iteration/develop to its previous state
179
- - Restore the feature branch from the backup
180
- - HALT: "Rebase broke the build. Feature branch preserved at {branch-name}."
181
- - Do NOT delete the backup - leave it for manual resolution
182
- ```
183
-
184
- ```bash
185
- cd ${SUBMODULE}
186
- FEATURE_BRANCH=$(git branch --show-current)
187
-
188
- if [ "${FEATURE_BRANCH}" != "iteration/develop" ]; then
189
- FEATURE_SHA=$(git rev-parse HEAD)
190
- ITER_BASE=$(git merge-base ${FEATURE_BRANCH} origin/iteration/develop)
191
-
192
- # Backup
193
- git branch backup/${FEATURE_BRANCH}
194
-
195
- # Collect feature commits (from where it diverged from iteration/develop)
196
- COMMITS=$(git log --oneline ${ITER_BASE}..${FEATURE_BRANCH} --reverse --format="%H")
197
-
198
- # Switch to iteration/develop
199
- git fetch origin iteration/develop
200
- git checkout iteration/develop
201
- git reset --hard origin/iteration/develop
202
-
203
- # Cherry-pick feature commits
204
- for COMMIT in ${COMMITS}; do
205
- git cherry-pick ${COMMIT} || {
206
- # CONFLICT HANDLING - do NOT abort or delete any changes
207
- echo "⚠️ Cherry-pick conflict at ${COMMIT}."
208
- echo "Conflicting files:"
209
- CONFLICTED_FILES=$(git diff --name-only --diff-filter=U)
210
- echo "${CONFLICTED_FILES}"
211
-
212
- # Auto-resolve by file classification (see "Conflict File Classification" section)
213
- AUTO_RESOLVED=()
214
- MANUAL_NEEDED=()
215
-
216
- for FILE in ${CONFLICTED_FILES}; do
217
- case "${FILE}" in
218
- iOS/Sources/*/Generated/*|Shared/Figma/Generated/*|iOS/Sources/LocalizationAssets/Resources/*.xcstrings|iOS/Sources/AccessibilityAssets/Resources/*.xcstrings|Shared/Localization/*/Metadata/*|Shared/UITestingIdentifiers/Metadata/*)
219
- # Accept remote (will regenerate)
220
- git checkout --ours "${FILE}" && git add "${FILE}"
221
- AUTO_RESOLVED+=("${FILE} → accepted remote (will regenerate)")
222
- ;;
223
- Sources/Suggested/*.json|Shared/Figma/Components/*.json)
224
- # Our version wins (we created these)
225
- git checkout --theirs "${FILE}" && git add "${FILE}"
226
- AUTO_RESOLVED+=("${FILE} → kept ours (we created it)")
227
- ;;
228
- Shared/UITestingIdentifiers/ui-testing-identifiers.json)
229
- # Take remote + re-add keys via tool (see Guardrails)
230
- git checkout --ours "${FILE}" && git add "${FILE}"
231
- AUTO_RESOLVED+=("${FILE} → accepted remote (will re-add keys via tool after)")
232
- ;;
233
- Shared/UIAssets/Colors/*.json)
234
- # Take remote + manually insert new entries
235
- git checkout --ours "${FILE}" && git add "${FILE}"
236
- AUTO_RESOLVED+=("${FILE} → accepted remote (will insert new entries after)")
237
- ;;
238
- *)
239
- MANUAL_NEEDED+=("${FILE}")
240
- ;;
241
- esac
242
- done
243
-
244
- if [ ${#AUTO_RESOLVED[@]} -gt 0 ]; then
245
- echo "\n✅ Auto-resolved files:"
246
- for ENTRY in "${AUTO_RESOLVED[@]}"; do echo " - ${ENTRY}"; done
247
- fi
248
-
249
- # If ui-testing-identifiers.json was conflicted, re-add our keys via /common-utility
250
- if echo "${CONFLICTED_FILES}" | grep -q 'ui-testing-identifiers.json'; then
251
- echo "\n📋 Re-adding our keys to ui-testing-identifiers.json via /common-utility (utility-add-key)..."
252
- # Agent: use /common-utility utility-add-key for each key from Shared/Figma/Components/{nodeId}.json
253
- fi
254
-
255
- # If all files were auto-resolved, rebuild and continue
256
- if [ ${#MANUAL_NEEDED[@]} -eq 0 ]; then
257
- echo "\n✅ All conflicts auto-resolved."
258
-
259
- # ── ui-testing-identifiers.json integrity guard (ALWAYS run before rebuild) ──
260
- # The implement agent regenerates this file from identifier-keys.json only.
261
- # An auto-merge can silently drop keys that exist on iteration/develop but not locally.
262
- REMOTE_KEY_COUNT=$(git show origin/iteration/develop:Shared/UITestingIdentifiers/ui-testing-identifiers.json 2>/dev/null | grep -c '".*" : "' || echo 0)
263
- LOCAL_KEY_COUNT=$(grep -c '".*" : "' Shared/UITestingIdentifiers/ui-testing-identifiers.json 2>/dev/null || echo 0)
264
- if [ "${LOCAL_KEY_COUNT}" -lt "${REMOTE_KEY_COUNT}" ]; then
265
- MISSING=$((REMOTE_KEY_COUNT - LOCAL_KEY_COUNT))
266
- echo "⚠️ INTEGRITY FIX: ui-testing-identifiers.json lost ${MISSING} keys vs origin/iteration/develop. Restoring..."
267
- git show origin/iteration/develop:Shared/UITestingIdentifiers/ui-testing-identifiers.json \
268
- > Shared/UITestingIdentifiers/ui-testing-identifiers.json
269
- .build/debug/UITestingIdentifierTool generate \
270
- --config Shared/UITestingIdentifiers/Config/identifier-config.json
271
- git add Shared/UITestingIdentifiers/ui-testing-identifiers.json
272
- git add iOS/Sources/UITestingIdentifiers/Generated/UITestingIdentifierKeys.swift
273
- echo "✅ Restored ${REMOTE_KEY_COUNT} remote keys + re-added component keys."
274
- fi
275
- # ─────────────────────────────────────────────────────────────────────────────
276
-
277
- # ── Generated Swift keys integrity guard (ALWAYS run before rebuild) ──
278
- # The codegen tool regenerates from config JSONs + Sources/Suggested/*.json.
279
- # An auto-merge can silently drop enum blocks from other developers' components.
280
- LOC_FILE="iOS/Sources/LocalizationStringKeys/Generated/LocalizationStringKeys.swift"
281
- A11Y_FILE="iOS/Sources/AccessibilityStringKeys/Generated/LocalizedAccessibilityStringKeys.swift"
282
- for GEN_FILE in "$LOC_FILE" "$A11Y_FILE"; do
283
- REMOTE_ENUMS=$(git show origin/iteration/develop:"${GEN_FILE}" 2>/dev/null | grep -oE 'enum [A-Za-z0-9_]+' | sort -u || true)
284
- LOCAL_ENUMS=$(grep -oE 'enum [A-Za-z0-9_]+' "${GEN_FILE}" 2>/dev/null | sort -u || true)
285
- MISSING_ENUMS=$(comm -23 <(echo "$REMOTE_ENUMS") <(echo "$LOCAL_ENUMS"))
286
- if [ -n "$MISSING_ENUMS" ]; then
287
- echo "⚠️ INTEGRITY FIX: ${GEN_FILE##*/} lost enum blocks vs origin/iteration/develop:"
288
- echo "$MISSING_ENUMS"
289
- echo " Restoring remote version (rebuild will re-add our component's keys)..."
290
- git show origin/iteration/develop:"${GEN_FILE}" > "${GEN_FILE}"
291
- git add "${GEN_FILE}"
292
- fi
293
- done
294
- # ─────────────────────────────────────────────────────────────────────────────
295
-
296
-
297
- # ── Sources/Suggested/*.json integrity guard (ALWAYS run before rebuild) ──
298
- # The implement agent only creates source JSONs for the current component.
299
- # A cherry-pick or git add -A can silently drop source JSONs from other components.
300
- for SUGGESTED_DIR in \
301
- "Shared/Localization/LocalizationStrings/Sources/Suggested" \
302
- "Shared/Localization/AccessibilityStrings/Sources/Suggested"; do
303
-
304
- REMOTE_FILES=$(git ls-tree --name-only origin/iteration/develop -- "${SUGGESTED_DIR}/" 2>/dev/null | sed "s|${SUGGESTED_DIR}/||" | sort)
305
- LOCAL_FILES=$(ls -1 "${SUGGESTED_DIR}/" 2>/dev/null | sort)
306
- MISSING_FILES=$(comm -23 <(echo "$REMOTE_FILES") <(echo "$LOCAL_FILES"))
307
-
308
- if [ -n "$MISSING_FILES" ]; then
309
- MISSING_COUNT=$(echo "$MISSING_FILES" | wc -l | tr -d ' ')
310
- echo "⚠️ INTEGRITY FIX: ${SUGGESTED_DIR##*/} lost ${MISSING_COUNT} source JSON file(s) vs origin/iteration/develop:"
311
- echo "$MISSING_FILES" | head -20
312
- echo " Restoring missing files from origin/iteration/develop..."
313
- while IFS= read -r FILE; do
314
- git show "origin/iteration/develop:${SUGGESTED_DIR}/${FILE}" > "${SUGGESTED_DIR}/${FILE}"
315
- git add "${SUGGESTED_DIR}/${FILE}"
316
- done <<< "$MISSING_FILES"
317
- echo "✅ Restored ${MISSING_COUNT} missing source JSON file(s)."
318
- fi
319
- done
320
- # ─────────────────────────────────────────────────────────────────────────────
321
-
322
- echo "Rebuilding derived artifacts..."
323
- bash "${REPO_ROOT}/.instructions/common/scripts/common-rebuild-derived-artifacts.sh"
324
- git add -A
325
- git cherry-pick --continue
326
- else
327
- # Show remaining conflicts that need manual resolution
328
- echo "\n⚠️ Files needing manual resolution:"
329
- for FILE in "${MANUAL_NEEDED[@]}"; do
330
- echo "\n--- Conflict in: ${FILE} ---"
331
- grep -n '<<<<<<<\|=======\|>>>>>>>' "${FILE}" || true
332
- done
333
-
334
- echo "\n📋 Suggested resolution:"
335
- echo " - Review the conflict markers above"
336
- echo " - Both local (feature) and remote (iteration/develop) changes are preserved in the conflict markers"
337
- echo " - Edit the conflicting files to keep the desired changes from both sides"
338
- echo " - Then run: git add <resolved-files> && git cherry-pick --continue"
339
- echo " - After resolving, rebuild: bash \"${REPO_ROOT}/.instructions/common/scripts/common-rebuild-derived-artifacts.sh\""
340
- echo " - Backup branch is available at: backup/${FEATURE_BRANCH}"
341
-
342
- # ASK the user whether to continue
343
- # The agent MUST use the ask-questions tool here:
344
- # Question: "Cherry-pick conflict detected. Auto-resolved N files, M need manual resolution.
345
- # Would you like to: (a) resolve manually and continue, or (b) abort the commit?"
346
- # If user chooses (b): git cherry-pick --abort && git checkout ${FEATURE_BRANCH} && exit 1
347
- # If user chooses (a): wait for user to resolve, then rebuild derived artifacts, then git cherry-pick --continue
348
- #
349
- # IMPORTANT: Do NOT auto-abort. Do NOT delete the feature branch.
350
- # Leave all changes intact and let the user decide.
351
- fi
352
- }
353
- done
354
-
355
- # Build validation after rebase (STEP 1a will run fully later, this is a quick gate)
356
- # If build fails, restore from backup
357
- # If build succeeds, clean up branches (after full STEP 1 passes and push succeeds in STEP 3b)
358
- fi
359
- ```
360
-
361
- **Important:** Do NOT delete feature branches until STEP 3b push succeeds. Track them for cleanup:
362
- ```
363
- BRANCHES_TO_CLEANUP=("common:${FEATURE_BRANCH}" ...)
364
- ```
365
- After successful push in STEP 3b, delete each:
366
- ```bash
367
- git branch -D ${FEATURE_BRANCH}
368
- git push origin --delete ${FEATURE_BRANCH}
369
- git branch -D backup/${FEATURE_BRANCH}
370
- ```
371
-
372
- ---
373
-
374
- ## STEP 1 - Validate
375
-
376
- ### 1a. Build
377
-
378
- ```bash
379
- xcodebuild build -project "${REPO_ROOT}/{build.xcodeproj}" \
380
- -scheme {build.scheme} -destination 'generic/platform=iOS' \
381
- CODE_SIGNING_ALLOWED=NO -quiet
382
- ```
383
-
384
- If build fails → HALT. Fix before committing.
385
-
386
- ### 1b. Tests
387
-
388
- Run component tests:
389
-
390
- ```bash
391
- xcodebuild test -project "${REPO_ROOT}/{build.xcodeproj}" \
392
- -scheme {build.scheme} -destination 'platform=iOS Simulator,name=iPhone 16 Pro' \
393
- -only-testing:"UIComponentsTests/${ComponentName}ViewInspectorTests" \
394
- -only-testing:"UIComponentsTests/${ComponentName}SnapshotTests" \
395
- CODE_SIGNING_ALLOWED=NO -quiet
396
- ```
397
-
398
- If tests fail → HALT. Fix before committing.
399
-
400
- ### 1c. Key Sync Validation
401
-
402
- Verify localization, accessibility, and testing identifier keys are in sync:
403
-
404
- ```bash
405
- cd ${COMMON}
406
- python3 .instructions/figma/figma-to-swiftui/scripts/validate-localization-sync.py \
407
- --component "{ComponentName}"
408
- ```
409
-
410
- If out of sync → HALT. Regenerate with `update-*-dev` (NOT `generate-*-code` - see common-utility docs):
411
- ```bash
412
- swift package plugin --allow-writing-to-package-directory update-localizations-dev
413
- swift package plugin --allow-writing-to-package-directory update-accessibility-dev
414
- swift run UITestingIdentifierTool generate
415
- ```
416
-
417
- ### 1d. Code Review (lightweight)
418
-
419
- Read `.instructions/figma/figma-commit/REVIEW.md` and run the full 13-point checklist.
420
-
421
- - **Auto-fix** any fixable violations (magic numbers, missing identifiers, wrong patterns).
422
- - If auto-fixes applied, re-run build (STEP 1a) to verify.
423
- - If unfixable violations remain → print them, ask user whether to proceed or abort.
424
-
425
- Print validation result:
426
-
427
- ```
428
- Validation: PASS / FAIL
429
- Build: ✅
430
- Tests: ✅ (N passed)
431
- Key Sync: ✅
432
- Review: ✅ / ⚠️ (N warnings)
433
- ```
434
-
435
- ---
436
-
437
- ## STEP 2 - Detect Changes
438
-
439
- ```bash
440
- HAS_COMMON=$(cd "${COMMON}" && git status --porcelain | head -1)
441
- HAS_UICOMPONENTS=$(cd "${UICOMPONENTS}" && git status --porcelain | head -1)
442
- HAS_WIKI=$(cd "${WIKI}" && git status --porcelain | head -1)
443
- ```
444
-
445
- ---
446
-
447
- ## STEP 3 - Commit Locally
448
-
449
- Commit to local `iteration/develop` in submodules. Do NOT push yet - pushing happens in STEP 3b after validation confirms the build is clean.
450
-
451
- ### 3a. Commit (local only)
452
-
453
- **Common (if HAS_COMMON):**
454
-
455
- > ⚠️ **Before `git add -A`**, run the Sources/Suggested integrity guard (see Guardrails). This prevents silently staging deletions of other components' source JSON files.
456
-
457
- ```bash
458
- cd ${COMMON}
459
-
460
- # ── Pre-commit Sources/Suggested integrity guard ──
461
- for SUGGESTED_DIR in \
462
- "Shared/Localization/LocalizationStrings/Sources/Suggested" \
463
- "Shared/Localization/AccessibilityStrings/Sources/Suggested"; do
464
-
465
- REMOTE_FILES=$(git ls-tree --name-only origin/iteration/develop -- "${SUGGESTED_DIR}/" 2>/dev/null | sed "s|${SUGGESTED_DIR}/||" | sort)
466
- LOCAL_FILES=$(ls -1 "${SUGGESTED_DIR}/" 2>/dev/null | sort)
467
- MISSING_FILES=$(comm -23 <(echo "$REMOTE_FILES") <(echo "$LOCAL_FILES"))
468
-
469
- if [ -n "$MISSING_FILES" ]; then
470
- MISSING_COUNT=$(echo "$MISSING_FILES" | wc -l | tr -d ' ')
471
- echo "⚠️ PRE-COMMIT FIX: ${SUGGESTED_DIR##*/} missing ${MISSING_COUNT} source JSON file(s) vs origin. Restoring..."
472
- while IFS= read -r FILE; do
473
- git show "origin/iteration/develop:${SUGGESTED_DIR}/${FILE}" > "${SUGGESTED_DIR}/${FILE}"
474
- done <<< "$MISSING_FILES"
475
- echo "✅ Restored ${MISSING_COUNT} file(s). They will be included in the commit."
476
- fi
477
- done
478
- # ──────────────────────────────────────────────────
479
-
480
- git add -A
481
- git commit -m "feat(common): [${JIRA_ISSUE}] add ${COMPONENT_PASCAL} tokens and keys
482
-
483
- Refs: ${JIRA_ISSUE}"
484
- ```
485
-
486
- **UIComponents (if HAS_UICOMPONENTS):**
487
-
488
- ```bash
489
- cd ${UICOMPONENTS}
490
- git add -A
491
- git commit -m "feat(uicomponents): [${JIRA_ISSUE}] add ${COMPONENT_PASCAL} component
492
-
493
- Refs: ${JIRA_ISSUE}"
494
- ```
495
-
496
- **Wiki (if HAS_WIKI):**
497
-
498
- ```bash
499
- cd ${WIKI}
500
- git add -A
501
- git commit -m "docs: [${JIRA_ISSUE}] add ${COMPONENT_PASCAL} wiki documentation
502
-
503
- Refs: ${JIRA_ISSUE}"
504
- ```
505
-
506
- ---
507
-
508
- ### ⛔ 3a-gate - Pre-Push Approval (required HARD STOP)
509
-
510
- > **Do NOT proceed to STEP 3b until the user explicitly approves.**
511
- > Use the `ask-questions` tool here. A silent "yes" assumption is a pipeline violation.
512
-
513
- **Print the following push summary for every submodule that has local commits:**
514
-
515
- ```
516
- ╔══════════════════════════════════════════════════════════════════╗
517
- ║ PRE-PUSH SUMMARY - iteration/develop ║
518
- ╠══════════════════════════════════════════════════════════════════╣
519
- ║ common (if HAS_COMMON): ║
520
- ║ Branch : iteration/develop ║
521
- ║ Ahead : N commits ahead of origin/iteration/develop ║
522
- ║ Commits: (list each SHA + title) ║
523
- ║ Files : +X insertions, -Y deletions ║
524
- ╠══════════════════════════════════════════════════════════════════╣
525
- ║ uicomponents (if HAS_UICOMPONENTS): ║
526
- ║ Branch : iteration/develop ║
527
- ║ Ahead : N commits ahead of origin/iteration/develop ║
528
- ║ Commits: (list each SHA + title) ║
529
- ║ Files : +X insertions, -Y deletions ║
530
- ╠══════════════════════════════════════════════════════════════════╣
531
- ║ wiki (if HAS_WIKI): ║
532
- ║ Branch : master ║
533
- ║ Ahead : N commits ahead of origin/master ║
534
- ║ Commits: (list each SHA + title) ║
535
- ║ Files : +X insertions, -Y deletions ║
536
- ╚══════════════════════════════════════════════════════════════════╝
537
- ```
538
-
539
- Generate this summary with:
540
-
541
- ```bash
542
- # For each submodule with commits - adapt branch name per repo:
543
- cd ${SUBMODULE}
544
- echo "Ahead: $(git rev-list origin/${PUSH_BRANCH}..HEAD --count) commits"
545
- git log origin/${PUSH_BRANCH}..HEAD --oneline
546
- git diff origin/${PUSH_BRANCH}..HEAD --stat | tail -1
547
- ```
548
-
549
- **Then ask the user:**
550
-
551
- > ✅ All validations passed. The commits above are ready to push to `origin/iteration/develop`.
552
- >
553
- > **Ready to push? Reply `yes` to push, or `no` to stop here and leave local commits intact.**
554
-
555
- **Branching logic:**
556
-
557
- - If user replies **`yes`** (or `ok`, `go`, `approved`, `looks good`) → proceed to STEP 3b.
558
- - If user replies **`no`** (or `stop`, `cancel`, `wait`) → print:
559
-
560
- ```
561
- Push cancelled. Local commits preserved:
562
- common : <SHA>
563
- uicomponents : <SHA>
564
- wiki : <SHA>
565
-
566
- Run /figma-iteration-commit again when ready to push.
567
- ```
568
-
569
- Then **HALT** - do not revert any local commits, do not push anything.
570
-
571
- ---
572
-
573
- ### 3b. Push with Rebase-Retry Loop
574
-
575
- For each submodule (common, uicomponents), push with this logic:
576
-
577
- ```
578
- 1. Attempt push
579
- 2. If push succeeds → done
580
- 3. If push rejected (remote has new commits):
581
- a. Fetch latest from origin
582
- b. Rebase local commits onto updated remote
583
- c. Re-run build (STEP 1a) to verify nothing broke after rebase
584
- d. If build passes → retry push (go to 1)
585
- e. If build fails → HALT, report conflict
586
- ```
587
-
588
- **Per submodule:**
589
-
590
- ```bash
591
- cd ${SUBMODULE}
592
- PUSH_BRANCH="iteration/develop" # or "master" for wiki
593
-
594
- MAX_RETRIES=3
595
- for i in $(seq 1 $MAX_RETRIES); do
596
- git push origin ${PUSH_BRANCH} && break
597
-
598
- echo "Push rejected - remote updated. Rebasing (attempt $i)..."
599
- git fetch origin ${PUSH_BRANCH}
600
- git rebase origin/${PUSH_BRANCH}
601
-
602
- if [ $? -ne 0 ]; then
603
- # CONFLICT HANDLING - do NOT abort or delete any changes
604
- echo "⚠️ Rebase conflict detected during push retry."
605
- echo "Conflicting files:"
606
- CONFLICTED_FILES=$(git diff --name-only --diff-filter=U)
607
- echo "${CONFLICTED_FILES}"
608
-
609
- # Auto-resolve by file classification (see "Conflict File Classification" section)
610
- AUTO_RESOLVED=()
611
- MANUAL_NEEDED=()
612
-
613
- for FILE in ${CONFLICTED_FILES}; do
614
- case "${FILE}" in
615
- iOS/Sources/*/Generated/*|Shared/Figma/Generated/*|iOS/Sources/LocalizationAssets/Resources/*.xcstrings|iOS/Sources/AccessibilityAssets/Resources/*.xcstrings|Shared/Localization/*/Metadata/*|Shared/UITestingIdentifiers/Metadata/*)
616
- # Accept remote (will regenerate)
617
- git checkout --ours "${FILE}" && git add "${FILE}"
618
- AUTO_RESOLVED+=("${FILE} → accepted remote (will regenerate)")
619
- ;;
620
- Sources/Suggested/*.json|Shared/Figma/Components/*.json)
621
- # Our version wins (we created these)
622
- git checkout --theirs "${FILE}" && git add "${FILE}"
623
- AUTO_RESOLVED+=("${FILE} → kept ours (we created it)")
624
- ;;
625
- Shared/UITestingIdentifiers/ui-testing-identifiers.json)
626
- # Take remote + re-add keys via tool (see Guardrails)
627
- git checkout --ours "${FILE}" && git add "${FILE}"
628
- AUTO_RESOLVED+=("${FILE} → accepted remote (will re-add keys via tool after)")
629
- ;;
630
- Shared/UIAssets/Colors/*.json)
631
- # Take remote + manually insert new entries
632
- git checkout --ours "${FILE}" && git add "${FILE}"
633
- AUTO_RESOLVED+=("${FILE} → accepted remote (will insert new entries after)")
634
- ;;
635
- *)
636
- MANUAL_NEEDED+=("${FILE}")
637
- ;;
638
- esac
639
- done
640
-
641
- if [ ${#AUTO_RESOLVED[@]} -gt 0 ]; then
642
- echo "\n✅ Auto-resolved files:"
643
- for ENTRY in "${AUTO_RESOLVED[@]}"; do echo " - ${ENTRY}"; done
644
- fi
645
-
646
- # If ui-testing-identifiers.json was conflicted, re-add our keys via /common-utility
647
- if echo "${CONFLICTED_FILES}" | grep -q 'ui-testing-identifiers.json'; then
648
- echo "\n📋 Re-adding our keys to ui-testing-identifiers.json via /common-utility (utility-add-key)..."
649
- # Agent: use /common-utility utility-add-key for each key from Shared/Figma/Components/{nodeId}.json
650
- fi
651
-
652
- # If all files were auto-resolved, rebuild and continue
653
- if [ ${#MANUAL_NEEDED[@]} -eq 0 ]; then
654
- echo "\n✅ All conflicts auto-resolved."
655
-
656
- # ── ui-testing-identifiers.json integrity guard (ALWAYS run before rebuild) ──
657
- # The implement agent regenerates this file from identifier-keys.json only.
658
- # An auto-merge can silently drop keys that exist on iteration/develop but not locally.
659
- REMOTE_KEY_COUNT=$(git show origin/iteration/develop:Shared/UITestingIdentifiers/ui-testing-identifiers.json 2>/dev/null | grep -c '".*" : "' || echo 0)
660
- LOCAL_KEY_COUNT=$(grep -c '".*" : "' Shared/UITestingIdentifiers/ui-testing-identifiers.json 2>/dev/null || echo 0)
661
- if [ "${LOCAL_KEY_COUNT}" -lt "${REMOTE_KEY_COUNT}" ]; then
662
- MISSING=$((REMOTE_KEY_COUNT - LOCAL_KEY_COUNT))
663
- echo "⚠️ INTEGRITY FIX: ui-testing-identifiers.json lost ${MISSING} keys vs origin/iteration/develop. Restoring..."
664
- git show origin/iteration/develop:Shared/UITestingIdentifiers/ui-testing-identifiers.json \
665
- > Shared/UITestingIdentifiers/ui-testing-identifiers.json
666
- .build/debug/UITestingIdentifierTool generate \
667
- --config Shared/UITestingIdentifiers/Config/identifier-config.json
668
- git add Shared/UITestingIdentifiers/ui-testing-identifiers.json
669
- git add iOS/Sources/UITestingIdentifiers/Generated/UITestingIdentifierKeys.swift
670
- echo "✅ Restored ${REMOTE_KEY_COUNT} remote keys + re-added component keys."
671
- fi
672
- # ─────────────────────────────────────────────────────────────────────────────
673
-
674
- # ── Generated Swift keys integrity guard (ALWAYS run before rebuild) ──
675
- # The codegen tool regenerates from config JSONs + Sources/Suggested/*.json.
676
- # An auto-merge can silently drop enum blocks from other developers' components.
677
- LOC_FILE="iOS/Sources/LocalizationStringKeys/Generated/LocalizationStringKeys.swift"
678
- A11Y_FILE="iOS/Sources/AccessibilityStringKeys/Generated/LocalizedAccessibilityStringKeys.swift"
679
- for GEN_FILE in "$LOC_FILE" "$A11Y_FILE"; do
680
- REMOTE_ENUMS=$(git show origin/iteration/develop:"${GEN_FILE}" 2>/dev/null | grep -oE 'enum [A-Za-z0-9_]+' | sort -u || true)
681
- LOCAL_ENUMS=$(grep -oE 'enum [A-Za-z0-9_]+' "${GEN_FILE}" 2>/dev/null | sort -u || true)
682
- MISSING_ENUMS=$(comm -23 <(echo "$REMOTE_ENUMS") <(echo "$LOCAL_ENUMS"))
683
- if [ -n "$MISSING_ENUMS" ]; then
684
- echo "⚠️ INTEGRITY FIX: ${GEN_FILE##*/} lost enum blocks vs origin/iteration/develop:"
685
- echo "$MISSING_ENUMS"
686
- echo " Restoring remote version (rebuild will re-add our component's keys)..."
687
- git show origin/iteration/develop:"${GEN_FILE}" > "${GEN_FILE}"
688
- git add "${GEN_FILE}"
689
- fi
690
- done
691
- # ─────────────────────────────────────────────────────────────────────────────
692
-
693
- # ── Sources/Suggested/*.json integrity guard (ALWAYS run before rebuild) ──
694
- for SUGGESTED_DIR in \
695
- "Shared/Localization/LocalizationStrings/Sources/Suggested" \
696
- "Shared/Localization/AccessibilityStrings/Sources/Suggested"; do
697
-
698
- REMOTE_FILES=$(git ls-tree --name-only origin/iteration/develop -- "${SUGGESTED_DIR}/" 2>/dev/null | sed "s|${SUGGESTED_DIR}/||" | sort)
699
- LOCAL_FILES=$(ls -1 "${SUGGESTED_DIR}/" 2>/dev/null | sort)
700
- MISSING_FILES=$(comm -23 <(echo "$REMOTE_FILES") <(echo "$LOCAL_FILES"))
701
-
702
- if [ -n "$MISSING_FILES" ]; then
703
- MISSING_COUNT=$(echo "$MISSING_FILES" | wc -l | tr -d ' ')
704
- echo "⚠️ INTEGRITY FIX: ${SUGGESTED_DIR##*/} lost ${MISSING_COUNT} source JSON file(s) vs origin/iteration/develop:"
705
- echo "$MISSING_FILES" | head -20
706
- echo " Restoring missing files from origin/iteration/develop..."
707
- while IFS= read -r FILE; do
708
- git show "origin/iteration/develop:${SUGGESTED_DIR}/${FILE}" > "${SUGGESTED_DIR}/${FILE}"
709
- git add "${SUGGESTED_DIR}/${FILE}"
710
- done <<< "$MISSING_FILES"
711
- echo "✅ Restored ${MISSING_COUNT} missing source JSON file(s)."
712
- fi
713
- done
714
- # ─────────────────────────────────────────────────────────────────────────────
715
-
716
- echo "Rebuilding derived artifacts..."
717
- bash "${REPO_ROOT}/.instructions/common/scripts/common-rebuild-derived-artifacts.sh"
718
- git add -A
719
- git rebase --continue
720
- else
721
- # Show remaining conflicts that need manual resolution
722
- echo "\n⚠️ Files needing manual resolution:"
723
- for FILE in "${MANUAL_NEEDED[@]}"; do
724
- echo "\n--- Conflict in: ${FILE} ---"
725
- grep -n '<<<<<<<\|=======\|>>>>>>>' "${FILE}" || true
726
- done
727
-
728
- echo "\n📋 Suggested resolution:"
729
- echo " - Review the conflict markers above"
730
- echo " - Both local and remote changes are preserved in the conflict markers"
731
- echo " - Edit the conflicting files to keep the desired changes from both sides"
732
- echo " - After resolving, rebuild: bash \"${REPO_ROOT}/.instructions/common/scripts/common-rebuild-derived-artifacts.sh\""
733
- echo " - Then run: git add <resolved-files> && git rebase --continue"
734
-
735
- # ASK the user whether to continue
736
- # The agent MUST use the ask-questions tool here:
737
- # Question: "Rebase conflict detected during push. Auto-resolved N files, M need manual resolution.
738
- # Would you like to: (a) resolve manually and continue pushing, or (b) abort the rebase and stop?"
739
- # If user chooses (b): git rebase --abort && HALT
740
- # If user chooses (a): wait for user to resolve, then rebuild derived artifacts, then git rebase --continue and re-validate build
741
- #
742
- # IMPORTANT: Do NOT auto-abort. Do NOT delete any committed changes.
743
- # Leave all changes intact and let the user decide.
744
- fi
745
- fi
746
-
747
- # Re-validate build after rebase
748
- xcodebuild build -project "${REPO_ROOT}/{build.xcodeproj}" \
749
- -scheme {build.scheme} -destination 'generic/platform=iOS' \
750
- CODE_SIGNING_ALLOWED=NO -quiet
751
-
752
- if [ $? -ne 0 ]; then
753
- echo "HALT: Build failed after rebase. Fix before pushing."
754
- exit 1
755
- fi
756
- done
757
- ```
758
-
759
- ### 3c. Fetch all remotes
760
-
761
- After successful push, sync all local branches:
762
-
763
- ```bash
764
- cd ${MAIN_REPO} && git fetch origin develop
765
- cd ${COMMON} && git fetch origin iteration/develop
766
- cd ${UICOMPONENTS} && git fetch origin iteration/develop
767
- ```
768
-
769
- ---
770
-
771
- ## STEP 4 - Issue Housekeeping
772
-
773
- ### 4a. Comment on issue
774
-
775
- If issue was found/provided:
776
-
777
- ```bash
778
- COMMON_SHA=$(git -C ${COMMON} rev-parse --short HEAD)
779
- UICOMP_SHA=$(git -C ${UICOMPONENTS} rev-parse --short HEAD)
780
-
781
- gh issue comment <N> --repo ${GH_REPO} --body "$(cat <<'EOF'
782
- Committed to iteration/develop (submodules):
783
- - common: ${COMMON_SHA}
784
- - uicomponents: ${UICOMP_SHA}
785
-
786
- Ready for review.
787
- EOF
788
- )"
789
- ```
790
-
791
- ### 4b. Sync issue from registry
792
-
793
- Phase state is tracked per-flag in the component registry
794
- (`status.ios.{implemented,tested,codeConnect,wiki}`), written by the
795
- phase finalize scripts during STEP 2 of `/figma-cli-iterate`. The
796
- issue's labels and Progress table are projections of that state - no
797
- filesystem inference anymore.
798
-
799
- Run the registry sync once, after the commit succeeds:
800
-
801
- ```bash
802
- python3 .instructions/figma/figma-to-swiftui/scripts/update-issue-from-registry.py \
803
- --node-id "<NODE_ID>" \
804
- --platform ios
805
- ```
806
-
807
- This call is idempotent:
808
-
809
- - Adds/removes `impl:*`/`test:*`/`cc:*`/`wiki:*` labels to match
810
- registry state (green when current, yellow when stale or against an
811
- older impl.version).
812
- - Rewrites the `### Progress` table in the issue body.
813
- - Strips any legacy `phase:*` labels.
814
- - If zero open issues reference this node-id, creates a new one with
815
- `team:core` as default.
816
- - If multiple open issues reference the node-id, closes all but the
817
- lowest-numbered one with a "Duplicate of #N" comment.
818
-
819
- If the call fails (gh not authenticated, rate limit, etc.), log the
820
- error but don't fail the commit - the sync can always be re-run
821
- manually or via `bulk-sync-issues.py`.
822
-
823
- ### 4c. Link wiki to issue
824
-
825
- If wiki was committed (HAS_WIKI), add or update the **Wiki** section in the issue body:
826
-
827
- ```
828
- WIKI_URL=https://github.com/${GH_REPO}/wiki/${COMPONENT_PASCAL}
829
- ```
830
-
831
- Read the current issue body, then:
832
- - If a `### Wiki` section already exists, replace its content with the new link.
833
- - If no `### Wiki` section exists, insert it before `### Notes`.
834
-
835
- The Wiki section format:
836
-
837
- ```markdown
838
- ### Wiki
839
-
840
- [${COMPONENT_PASCAL}](${WIKI_URL})
841
- ```
842
-
843
- Use a Python script written to a temp file to avoid shell quoting issues with `gh issue edit --body-file`:
844
-
845
- ```python
846
- import subprocess, json, re
847
-
848
- COMPONENT = "${COMPONENT_PASCAL}"
849
- GH_REPO = "${GH_REPO}"
850
- ISSUE_N = <N>
851
- WIKI_URL = f"https://github.com/{GH_REPO}/wiki/{COMPONENT}"
852
- WIKI_SECTION = f"### Wiki\n\n[{COMPONENT}]({WIKI_URL})"
853
-
854
- result = subprocess.run(
855
- ["gh", "issue", "view", str(ISSUE_N), "--repo", GH_REPO, "--json", "body"],
856
- capture_output=True, text=True)
857
- body = json.loads(result.stdout)["body"]
858
-
859
- if "### Wiki" in body:
860
- body = re.sub(r"### Wiki\n\n.*?\n(\n###|\Z)", lambda m: WIKI_SECTION + "\n" + m.group(1), body, flags=re.DOTALL)
861
- else:
862
- body = body.replace("### Notes", WIKI_SECTION + "\n\n### Notes")
863
-
864
- with open("/tmp/issue_body_update.md", "w") as f:
865
- f.write(body)
866
-
867
- subprocess.run(["gh", "issue", "edit", str(ISSUE_N), "--repo", GH_REPO, "--body-file", "/tmp/issue_body_update.md"])
868
- ```
869
-
870
- ### 4d. Link Sub-Component Issues
871
-
872
- Read the nested components artifact to find which sub-components this component uses:
873
-
874
- ```bash
875
- # Get artifactPath from registry
876
- ARTIFACT_PATH=$(cd ${COMMON} && .build/debug/FigmaRegistryUtility lookup --node-id "${NODE_ID}" 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('suggestedArtifactPath',''))" 2>/dev/null || echo "")
877
-
878
- NESTED_FILE="${REPO_ROOT}/${ARTIFACT_PATH}/pass3/03_nested_components.md"
879
- ```
880
-
881
- If `NESTED_FILE` does not exist → skip this step silently.
882
-
883
- If it exists, parse connected components:
884
-
885
- ```bash
886
- # Extract component names from the Connected Components table in 03_nested_components.md
887
- # Lines look like: | ComponentName | Sources/... | `Init...` |
888
- CONNECTED_COMPONENTS=$(grep '^\| [A-Z]' "${NESTED_FILE}" | awk -F'|' '{print $2}' | tr -d ' ')
889
- ```
890
-
891
- For each connected component name, find its GitHub issue and add as sub-issue:
892
-
893
- ```python
894
- import subprocess, json, re
895
-
896
- GH_REPO = "${GH_REPO}"
897
- PARENT_ISSUE_N = <N>
898
-
899
- # Read connected components from nested file
900
- nested_path = "${NESTED_FILE}"
901
- connected = []
902
- in_connected_section = False
903
-
904
- with open(nested_path) as f:
905
- for line in f:
906
- if line.strip() == "## Connected Components":
907
- in_connected_section = True
908
- continue
909
- if in_connected_section and line.startswith("## "):
910
- break
911
- if in_connected_section and line.startswith("| "):
912
- parts = [p.strip() for p in line.split("|")]
913
- # parts[1] = component name, skip header and separator rows
914
- if len(parts) > 2 and parts[1] and not parts[1].startswith("-") and parts[1] != "Component":
915
- connected.append(parts[1])
916
-
917
- sub_issues_added = []
918
-
919
- for comp_name in connected:
920
- # Search for the sub-component's issue
921
- result = subprocess.run(
922
- ["gh", "issue", "list", "--repo", GH_REPO, "--state", "open",
923
- "--label", "component", "--search", comp_name,
924
- "--json", "number,title"],
925
- capture_output=True, text=True
926
- )
927
- if result.returncode != 0:
928
- print(f" ⚠️ Could not search issue for {comp_name}")
929
- continue
930
-
931
- issues = json.loads(result.stdout)
932
- # Find closest match (title contains exact component name)
933
- match = next((i for i in issues if comp_name.lower() in i["title"].lower()), None)
934
- if not match:
935
- print(f" ⚠️ No open issue found for sub-component: {comp_name}")
936
- continue
937
-
938
- sub_issue_n = match["number"]
939
-
940
- # Add as sub-issue via GitHub API
941
- api_result = subprocess.run(
942
- ["gh", "api", "--method", "POST",
943
- f"repos/{GH_REPO}/issues/{PARENT_ISSUE_N}/sub_issues",
944
- "--field", f"sub_issue_id={sub_issue_n}"],
945
- capture_output=True, text=True
946
- )
947
-
948
- if api_result.returncode == 0:
949
- sub_issues_added.append(f"#{sub_issue_n} ({comp_name})")
950
- print(f" ✅ Linked sub-issue #{sub_issue_n} ({comp_name})")
951
- else:
952
- # May already be linked - not a fatal error
953
- print(f" ℹ️ Could not link #{sub_issue_n} ({comp_name}): {api_result.stderr.strip()}")
954
-
955
- if sub_issues_added:
956
- print(f"\nSub-issues linked: {', '.join(sub_issues_added)}")
957
- else:
958
- print("No sub-issues linked (no matching open issues found).")
959
- ```
960
-
961
- > **Non-fatal:** If this step fails (artifact missing, gh API error, no matching issues), log and continue - it must never block the commit.
962
-
963
-
964
- ---
965
-
966
- ## STEP 5 - Auto-Unblock Dependents
967
-
968
- Scan all open issues with `blocked` label:
969
-
970
- ```bash
971
- gh issue list --repo ${GH_REPO} --state open --label blocked --json number,title,body
972
- ```
973
-
974
- For each blocked issue:
975
- 1. Read the issue body or sub-issue comments to find what it's blocked by (component names).
976
- 2. For each blocking component, check if `{ComponentName}.swift` exists:
977
- ```bash
978
- find ${UICOMPONENTS}/Sources -name "{BlockingComponent}.swift" -type f | head -1
979
- ```
980
- 3. If ALL blocking components now have Swift files → unblock:
981
- ```bash
982
- gh issue edit <BLOCKED_N> --repo ${GH_REPO} --remove-label "blocked"
983
- gh issue comment <BLOCKED_N> --repo ${GH_REPO} --body "Auto-unblocked: all dependencies now implemented."
984
- ```
985
-
986
- Print any unblocked issues.
987
-
988
- ---
989
-
990
- ## STEP 6 - Summary
991
-
992
- ```
993
- Iteration Commit: ${COMPONENT_PASCAL}
994
-
995
- | Repo | Commit | Status |
996
- |------|--------|--------|
997
- | common | ${COMMON_SHA} | ✅ pushed |
998
- | uicomponents | ${UICOMP_SHA} | ✅ pushed |
999
- | wiki | ${WIKI_SHA} | ✅ pushed |
1000
- | main | ${MAIN_SHA} | ✅ pushed / PR created |
1001
-
1002
- Validation: PASS
1003
- Issue: #N - commented + phase updated
1004
- Sub-issues: #X (ComponentA), #Y (ComponentB) (or "none")
1005
- Unblocked: #M, #K (or "none")
1006
- Jira: ${JIRA_ISSUE}
1007
- ```
1008
-
1009
- ---
1010
-
1011
- ## Error Handling
1012
-
1013
- - **Submodules not on iteration/develop**: Checkout automatically (rebase-merge if commits exist).
1014
- - **Build fails**: HALT - fix before committing.
1015
- - **Tests fail**: HALT - fix before committing.
1016
- - **Key sync fails**: HALT - regenerate keys first.
1017
- - **Push rejected**: Report error, do NOT force-push.
1018
- - **No changes**: Print "Nothing to commit" and exit.
1019
- - **Issue not found**: Commit without issue housekeeping, print warning.
1020
- - **Rebase/cherry-pick conflict**: Do NOT abort or delete any changes. Show conflicting files and conflict markers, suggest resolution steps, and ASK the user whether to (a) resolve and continue or (b) abort. Preserve all local and remote changes in conflict markers until the user decides. For `ui-testing-identifiers.json` conflicts, always suggest the take-remote + re-add-keys approach (see Guardrails).