openplanr 3.3.0 → 3.5.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 (493) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/dist/cli/commands/artifact-design-share.d.ts +9 -0
  3. package/dist/cli/commands/artifact-design-share.d.ts.map +1 -0
  4. package/dist/cli/commands/artifact-design-share.js +200 -0
  5. package/dist/cli/commands/artifact-design-share.js.map +1 -0
  6. package/dist/cli/commands/artifact.d.ts.map +1 -1
  7. package/dist/cli/commands/artifact.js +5 -18
  8. package/dist/cli/commands/artifact.js.map +1 -1
  9. package/dist/cli/commands/design.d.ts +3 -0
  10. package/dist/cli/commands/design.d.ts.map +1 -0
  11. package/dist/cli/commands/design.js +137 -0
  12. package/dist/cli/commands/design.js.map +1 -0
  13. package/dist/cli/commands/groups/operations.d.ts.map +1 -1
  14. package/dist/cli/commands/groups/operations.js +2 -0
  15. package/dist/cli/commands/groups/operations.js.map +1 -1
  16. package/dist/cli/commands/ship.d.ts.map +1 -1
  17. package/dist/cli/commands/ship.js +2 -0
  18. package/dist/cli/commands/ship.js.map +1 -1
  19. package/dist/dashboard/.vite/manifest.json +2 -2
  20. package/dist/dashboard/assets/index-B-l_941W.js +75 -0
  21. package/dist/dashboard/assets/index-B-l_941W.js.map +1 -0
  22. package/dist/dashboard/assets/index-Cv4Vwhuw.css +2 -0
  23. package/dist/dashboard/dashboard-manifest.json +14 -14
  24. package/dist/dashboard/index.html +2 -2
  25. package/dist/services/design-artifact-service.d.ts +42 -1
  26. package/dist/services/design-artifact-service.d.ts.map +1 -1
  27. package/dist/services/design-artifact-service.js +198 -19
  28. package/dist/services/design-artifact-service.js.map +1 -1
  29. package/dist/services/runtime-manager/runtime-package.js +1 -1
  30. package/dist/services/runtime-manager/runtime-package.js.map +1 -1
  31. package/dist/services/ship-checks/contract.d.ts +3 -1
  32. package/dist/services/ship-checks/contract.d.ts.map +1 -1
  33. package/dist/services/ship-checks/contract.js +1 -1
  34. package/dist/services/ship-checks/contract.js.map +1 -1
  35. package/dist/services/ship-checks/discover.d.ts.map +1 -1
  36. package/dist/services/ship-checks/discover.js +2 -1
  37. package/dist/services/ship-checks/discover.js.map +1 -1
  38. package/dist/services/ship-checks/package-contents.d.ts +4 -0
  39. package/dist/services/ship-checks/package-contents.d.ts.map +1 -0
  40. package/dist/services/ship-checks/package-contents.js +91 -0
  41. package/dist/services/ship-checks/package-contents.js.map +1 -0
  42. package/dist/services/ship-checks/packages.d.ts +2 -0
  43. package/dist/services/ship-checks/packages.d.ts.map +1 -1
  44. package/dist/services/ship-checks/packages.js +4 -0
  45. package/dist/services/ship-checks/packages.js.map +1 -1
  46. package/dist/services/ship-checks/scope.js +2 -1
  47. package/dist/services/ship-checks/scope.js.map +1 -1
  48. package/dist/utils/splice-managed-block.js +1 -1
  49. package/dist/utils/splice-managed-block.js.map +1 -1
  50. package/docs/CLI.md +67 -1
  51. package/lib/host-packages/adapter-registry.json +5 -5
  52. package/lib/host-packages/capability-map.json +1 -1
  53. package/lib/host-packages/claude/.claude-plugin/marketplace.json +3 -3
  54. package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +6 -6
  55. package/lib/host-packages/claude/openplanr/.openplanr-content.json +57 -429
  56. package/lib/host-packages/claude/openplanr/README.md +16 -16
  57. package/lib/host-packages/claude/openplanr/references/agents/shared/modes/shared/task-context-resolution.md +4 -4
  58. package/lib/host-packages/claude/openplanr/skills/artifact/references/design-sharing.md +2 -2
  59. package/lib/host-packages/claude/openplanr/skills/delegate/SKILL.md +2 -1
  60. package/lib/host-packages/claude/openplanr/skills/delegate/references/integration-review.md +26 -20
  61. package/lib/host-packages/claude/openplanr/skills/delegate/references/operator-guide.md +25 -1
  62. package/lib/host-packages/claude/openplanr/skills/delegate/references/run-handoff.md +2 -2
  63. package/lib/host-packages/claude/openplanr/skills/delegate/references/worktree-custody.md +17 -9
  64. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
  65. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
  66. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
  67. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/custody.mjs +217 -10
  68. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
  69. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
  70. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
  71. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
  72. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
  73. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
  74. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
  75. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
  76. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
  77. package/lib/host-packages/claude/openplanr/skills/design/SKILL.md +23 -12
  78. package/lib/host-packages/claude/openplanr/skills/design/references/design-system.md +2 -2
  79. package/lib/host-packages/claude/openplanr/skills/design/references/generation.md +3 -3
  80. package/lib/host-packages/claude/openplanr/skills/design/references/hosted-canvas.md +6 -3
  81. package/lib/host-packages/claude/openplanr/skills/design/references/review.md +6 -6
  82. package/lib/host-packages/claude/openplanr/skills/design/references/team-review.md +3 -4
  83. package/lib/host-packages/claude/openplanr/skills/design/references/utilities.md +78 -32
  84. package/lib/host-packages/claude/openplanr/skills/design-loop/SKILL.md +15 -7
  85. package/lib/host-packages/claude/openplanr/skills/design-loop/references/design-system.md +2 -2
  86. package/lib/host-packages/claude/openplanr/skills/design-loop/references/generation.md +3 -3
  87. package/lib/host-packages/claude/openplanr/skills/design-loop/references/review.md +6 -6
  88. package/lib/host-packages/claude/openplanr/skills/design-loop/references/team-review.md +3 -4
  89. package/lib/host-packages/claude/openplanr/skills/design-loop/references/utilities.md +78 -32
  90. package/lib/host-packages/claude/openplanr/skills/design-review/SKILL.md +25 -5
  91. package/lib/host-packages/claude/openplanr/skills/design-review/references/design-system.md +2 -2
  92. package/lib/host-packages/claude/openplanr/skills/design-review/references/generation.md +3 -3
  93. package/lib/host-packages/claude/openplanr/skills/design-review/references/review.md +6 -6
  94. package/lib/host-packages/claude/openplanr/skills/design-review/references/team-review.md +3 -4
  95. package/lib/host-packages/claude/openplanr/skills/design-review/references/utilities.md +78 -32
  96. package/lib/host-packages/claude/openplanr/skills/investigate/SKILL.md +1 -0
  97. package/lib/host-packages/claude/openplanr/skills/investigate/references/fail-first.md +40 -0
  98. package/lib/host-packages/claude/openplanr/skills/plan/SKILL.md +7 -3
  99. package/lib/host-packages/claude/openplanr/skills/ship/SKILL.md +22 -10
  100. package/lib/host-packages/claude/openplanr/skills/ship/references/fail-first.md +40 -0
  101. package/lib/host-packages/claude/openplanr/skills/ship/references/result-contract.md +7 -3
  102. package/lib/host-packages/cursor/openplanr/.openplanr-content.json +55 -427
  103. package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
  104. package/lib/host-packages/cursor/openplanr/rules/planr-artifact/references/design-sharing.md +2 -2
  105. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/integration-review.md +26 -20
  106. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/operator-guide.md +25 -1
  107. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/run-handoff.md +2 -2
  108. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/worktree-custody.md +17 -9
  109. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/claude.mjs +15 -3
  110. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/codex.mjs +38 -2
  111. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/native.mjs +5 -0
  112. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/custody.mjs +217 -10
  113. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/handoff.mjs +1080 -0
  114. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integrate.mjs +96 -201
  115. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-files.mjs +3 -382
  116. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/presentation.mjs +29 -12
  117. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-contract.mjs +11 -0
  118. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-execution.mjs +1 -1
  119. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-lifecycle.mjs +14 -10
  120. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-preparation.mjs +4 -0
  121. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-record.mjs +2 -2
  122. package/lib/host-packages/cursor/openplanr/rules/planr-delegate.mdc +2 -1
  123. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/design-system.md +2 -2
  124. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/generation.md +3 -3
  125. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/hosted-canvas.md +6 -3
  126. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/review.md +6 -6
  127. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/team-review.md +3 -4
  128. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/utilities.md +78 -32
  129. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/design-system.md +2 -2
  130. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/generation.md +3 -3
  131. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/review.md +6 -6
  132. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/team-review.md +3 -4
  133. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/utilities.md +78 -32
  134. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop.mdc +15 -7
  135. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/design-system.md +2 -2
  136. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/generation.md +3 -3
  137. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/review.md +6 -6
  138. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/team-review.md +3 -4
  139. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/utilities.md +78 -32
  140. package/lib/host-packages/cursor/openplanr/rules/planr-design-review.mdc +25 -5
  141. package/lib/host-packages/cursor/openplanr/rules/planr-design.mdc +23 -12
  142. package/lib/host-packages/cursor/openplanr/rules/planr-investigate/references/fail-first.md +40 -0
  143. package/lib/host-packages/cursor/openplanr/rules/planr-investigate.mdc +1 -0
  144. package/lib/host-packages/cursor/openplanr/rules/planr-plan.mdc +7 -3
  145. package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/fail-first.md +40 -0
  146. package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/result-contract.md +7 -3
  147. package/lib/host-packages/cursor/openplanr/rules/planr-ship.mdc +22 -10
  148. package/lib/host-packages/openai/.claude-plugin/marketplace.json +3 -3
  149. package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +2 -2
  150. package/lib/host-packages/openai/openplanr/.openplanr-content.json +62 -434
  151. package/lib/host-packages/openai/openplanr/skills/artifact/references/design-sharing.md +2 -2
  152. package/lib/host-packages/openai/openplanr/skills/delegate/SKILL.md +2 -1
  153. package/lib/host-packages/openai/openplanr/skills/delegate/openplanr.skill.json +1 -1
  154. package/lib/host-packages/openai/openplanr/skills/delegate/references/integration-review.md +26 -20
  155. package/lib/host-packages/openai/openplanr/skills/delegate/references/operator-guide.md +25 -1
  156. package/lib/host-packages/openai/openplanr/skills/delegate/references/run-handoff.md +2 -2
  157. package/lib/host-packages/openai/openplanr/skills/delegate/references/worktree-custody.md +17 -9
  158. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
  159. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
  160. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
  161. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/custody.mjs +217 -10
  162. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
  163. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
  164. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
  165. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
  166. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
  167. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
  168. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
  169. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
  170. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
  171. package/lib/host-packages/openai/openplanr/skills/design/SKILL.md +23 -12
  172. package/lib/host-packages/openai/openplanr/skills/design/openplanr.skill.json +0 -11
  173. package/lib/host-packages/openai/openplanr/skills/design/references/design-system.md +2 -2
  174. package/lib/host-packages/openai/openplanr/skills/design/references/generation.md +3 -3
  175. package/lib/host-packages/openai/openplanr/skills/design/references/hosted-canvas.md +6 -3
  176. package/lib/host-packages/openai/openplanr/skills/design/references/review.md +6 -6
  177. package/lib/host-packages/openai/openplanr/skills/design/references/team-review.md +3 -4
  178. package/lib/host-packages/openai/openplanr/skills/design/references/utilities.md +78 -32
  179. package/lib/host-packages/openai/openplanr/skills/design-loop/SKILL.md +15 -7
  180. package/lib/host-packages/openai/openplanr/skills/design-loop/openplanr.skill.json +0 -11
  181. package/lib/host-packages/openai/openplanr/skills/design-loop/references/design-system.md +2 -2
  182. package/lib/host-packages/openai/openplanr/skills/design-loop/references/generation.md +3 -3
  183. package/lib/host-packages/openai/openplanr/skills/design-loop/references/review.md +6 -6
  184. package/lib/host-packages/openai/openplanr/skills/design-loop/references/team-review.md +3 -4
  185. package/lib/host-packages/openai/openplanr/skills/design-loop/references/utilities.md +78 -32
  186. package/lib/host-packages/openai/openplanr/skills/design-review/SKILL.md +25 -5
  187. package/lib/host-packages/openai/openplanr/skills/design-review/openplanr.skill.json +0 -11
  188. package/lib/host-packages/openai/openplanr/skills/design-review/references/design-system.md +2 -2
  189. package/lib/host-packages/openai/openplanr/skills/design-review/references/generation.md +3 -3
  190. package/lib/host-packages/openai/openplanr/skills/design-review/references/review.md +6 -6
  191. package/lib/host-packages/openai/openplanr/skills/design-review/references/team-review.md +3 -4
  192. package/lib/host-packages/openai/openplanr/skills/design-review/references/utilities.md +78 -32
  193. package/lib/host-packages/openai/openplanr/skills/investigate/SKILL.md +1 -0
  194. package/lib/host-packages/openai/openplanr/skills/investigate/openplanr.skill.json +12 -1
  195. package/lib/host-packages/openai/openplanr/skills/investigate/references/fail-first.md +40 -0
  196. package/lib/host-packages/openai/openplanr/skills/plan/SKILL.md +7 -3
  197. package/lib/host-packages/openai/openplanr/skills/plan/openplanr.skill.json +0 -11
  198. package/lib/host-packages/openai/openplanr/skills/ship/SKILL.md +22 -10
  199. package/lib/host-packages/openai/openplanr/skills/ship/openplanr.skill.json +12 -1
  200. package/lib/host-packages/openai/openplanr/skills/ship/references/fail-first.md +40 -0
  201. package/lib/host-packages/openai/openplanr/skills/ship/references/result-contract.md +7 -3
  202. package/package.json +8 -8
  203. package/dist/dashboard/assets/index-BU5fzjyz.css +0 -1
  204. package/dist/dashboard/assets/index-B_96uzCl.js +0 -572
  205. package/dist/dashboard/assets/index-B_96uzCl.js.map +0 -1
  206. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1774
  207. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  208. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  209. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  210. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  211. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  212. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-handoff.mjs +0 -1576
  213. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  214. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  215. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  216. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  217. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  218. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +0 -3385
  219. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -39
  220. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
  221. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  222. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  223. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1113
  224. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs +0 -505
  225. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  226. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
  227. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  228. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design.mjs +0 -1430
  229. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2050
  230. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  231. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  232. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -809
  233. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -5693
  234. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  235. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  236. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +0 -1755
  237. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  238. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +0 -2633
  239. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -124
  240. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  241. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  242. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  243. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  244. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -133
  245. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  246. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  247. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  248. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
  249. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
  250. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
  251. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
  252. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
  253. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
  254. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
  255. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  256. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  257. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  258. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  259. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  260. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  261. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  262. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  263. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  264. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  265. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  266. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  267. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  268. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -159
  269. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  270. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  271. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  272. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  273. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  274. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  275. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  276. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  277. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  278. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  279. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  280. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  281. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  282. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  283. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  284. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  285. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  286. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  287. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  288. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  289. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  290. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  291. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  292. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -5468
  293. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +0 -2844
  294. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  295. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -159
  296. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  297. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
  298. package/lib/host-packages/claude/openplanr/skills/design/scripts/design.mjs +0 -12
  299. package/lib/host-packages/claude/openplanr/skills/design-loop/scripts/design.mjs +0 -12
  300. package/lib/host-packages/claude/openplanr/skills/design-review/scripts/design.mjs +0 -12
  301. package/lib/host-packages/claude/openplanr/skills/plan/scripts/design.mjs +0 -12
  302. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-transaction.mjs +0 -958
  303. package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/design.mjs +0 -12
  304. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/scripts/design.mjs +0 -12
  305. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/scripts/design.mjs +0 -12
  306. package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/design.mjs +0 -12
  307. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1774
  308. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  309. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  310. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  311. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  312. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  313. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-handoff.mjs +0 -1576
  314. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  315. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  316. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  317. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  318. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  319. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +0 -3385
  320. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -39
  321. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
  322. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  323. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  324. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1113
  325. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs +0 -505
  326. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  327. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
  328. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  329. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design.mjs +0 -1430
  330. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2050
  331. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  332. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  333. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -809
  334. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -5693
  335. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  336. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  337. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +0 -1755
  338. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  339. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +0 -2633
  340. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -124
  341. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  342. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  343. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  344. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  345. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -133
  346. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  347. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  348. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  349. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
  350. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
  351. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
  352. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
  353. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
  354. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
  355. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
  356. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  357. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  358. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  359. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  360. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  361. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  362. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  363. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  364. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  365. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  366. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  367. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  368. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  369. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -159
  370. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  371. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  372. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  373. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  374. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  375. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  376. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  377. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  378. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  379. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  380. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  381. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  382. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  383. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  384. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  385. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  386. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  387. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  388. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  389. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  390. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  391. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  392. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  393. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -5468
  394. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +0 -2844
  395. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  396. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -159
  397. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  398. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1774
  399. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  400. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  401. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  402. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  403. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  404. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-handoff.mjs +0 -1576
  405. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  406. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  407. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  408. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  409. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  410. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +0 -3385
  411. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -39
  412. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
  413. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  414. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  415. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1113
  416. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs +0 -505
  417. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  418. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
  419. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  420. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design.mjs +0 -1430
  421. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2050
  422. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  423. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  424. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -809
  425. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -5693
  426. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  427. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  428. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +0 -1755
  429. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  430. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +0 -2633
  431. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -124
  432. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  433. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  434. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  435. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  436. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -133
  437. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  438. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  439. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  440. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
  441. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
  442. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
  443. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
  444. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
  445. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
  446. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
  447. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  448. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  449. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  450. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  451. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  452. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  453. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  454. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  455. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  456. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  457. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  458. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  459. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  460. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -159
  461. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  462. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  463. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  464. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  465. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  466. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  467. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  468. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  469. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  470. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  471. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  472. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  473. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  474. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  475. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  476. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  477. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  478. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  479. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  480. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  481. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  482. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  483. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  484. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -5468
  485. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +0 -2844
  486. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  487. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -159
  488. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  489. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
  490. package/lib/host-packages/openai/openplanr/skills/design/scripts/design.mjs +0 -12
  491. package/lib/host-packages/openai/openplanr/skills/design-loop/scripts/design.mjs +0 -12
  492. package/lib/host-packages/openai/openplanr/skills/design-review/scripts/design.mjs +0 -12
  493. package/lib/host-packages/openai/openplanr/skills/plan/scripts/design.mjs +0 -12
@@ -1,1430 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- exportDesignReview,
4
- listArtifactReviewServers,
5
- resolveDesignPins,
6
- saveDesignState,
7
- serializeDesignReviewExport,
8
- startDesignReview,
9
- stopArtifactReviewServer
10
- } from "./design-review.mjs";
11
- import {
12
- readDesignFeedback,
13
- readDesignHandoff,
14
- updateDesignHandoff
15
- } from "./design-handoff.mjs";
16
- import {
17
- inspectDesignDocument,
18
- matchesDesignFrame,
19
- prepareDesignDocument,
20
- readDesignViewContext,
21
- renderDesignDocument,
22
- standaloneDesignHtml
23
- } from "./design-document.mjs";
24
- import "./design-artifact-shell.mjs";
25
- import "./design-sandbox-guards.mjs";
26
- import {
27
- ARTIFACT_REVIEW_MAX_STATE_BYTES,
28
- createReviewLedger,
29
- decodeArtifactReviewSources,
30
- exportDesignShareRecovery,
31
- importDesignShareRecovery,
32
- manageDesignShare,
33
- mergeReviewLedger,
34
- normalizeArtifactReview,
35
- publishDesignShare,
36
- readArtifactReviewState,
37
- resolveArtifactReviewDestination,
38
- shareDesign,
39
- syncDesignShare,
40
- withArtifactReviewLock,
41
- writeArtifactReviewState
42
- } from "./design-share.mjs";
43
- import {
44
- atomicJson,
45
- currentDesign,
46
- hash,
47
- listDesignRevisions,
48
- readDesignRevision,
49
- readJson
50
- } from "./design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs";
51
- import "./design-encrypted-workspace-client.mjs";
52
- import "./design-upload-spool.mjs";
53
- import "./design-chunked-workspace-client.mjs";
54
- import "./design-resource-pack.mjs";
55
- import "./design-compression.mjs";
56
- import "./design-owner-custody.mjs";
57
- import "./design-runtime-home.mjs";
58
- import {
59
- acquireStartLock
60
- } from "./design-loopback-server.mjs";
61
- import "./design-parse5-parser.mjs";
62
- import "./design-parse5-tokenizer.mjs";
63
- import "./design-entities.mjs";
64
- import {
65
- ARTIFACT_ERROR_CODES,
66
- PipelineError,
67
- digestArtifactEnvelope
68
- } from "./design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs";
69
- import "./design-shared-protocol-contracts-b5f28f94.mjs";
70
- import "./design-shared-protocol-contracts-75a938cc.mjs";
71
-
72
- // packages/design/lib/design/utility.mjs
73
- import { spawn } from "node:child_process";
74
- import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync, realpathSync, writeFileSync as writeFileSync2 } from "node:fs";
75
- import { dirname as dirname2, join as join4, resolve as resolve3 } from "node:path";
76
- import { fileURLToPath } from "node:url";
77
-
78
- // packages/design/lib/design/feedback-import.mjs
79
- import { closeSync, constants, fstatSync, openSync, readSync } from "node:fs";
80
- import { join, resolve } from "node:path";
81
- function invalid(message, code = ARTIFACT_ERROR_CODES.REVIEW_IMPORT) {
82
- throw new PipelineError(code, message);
83
- }
84
- function readDesignFeedbackImport(input) {
85
- if (typeof input !== "string" || !input.trim()) invalid("Feedback import requires a JSON file.");
86
- let fd;
87
- try {
88
- fd = openSync(resolve(input), constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
89
- const stat = fstatSync(fd);
90
- if (!stat.isFile()) invalid("Feedback import must be a regular JSON file.");
91
- if (stat.size > ARTIFACT_REVIEW_MAX_STATE_BYTES)
92
- invalid("Feedback import exceeds the 5 MB limit.", ARTIFACT_ERROR_CODES.REQUEST_LIMIT);
93
- const bytes = Buffer.alloc(ARTIFACT_REVIEW_MAX_STATE_BYTES + 1);
94
- let size = 0;
95
- while (size < bytes.length) {
96
- const read = readSync(fd, bytes, size, bytes.length - size, null);
97
- if (!read) break;
98
- size += read;
99
- }
100
- if (size > ARTIFACT_REVIEW_MAX_STATE_BYTES)
101
- invalid("Feedback import exceeds the 5 MB limit.", ARTIFACT_ERROR_CODES.REQUEST_LIMIT);
102
- return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes.subarray(0, size)));
103
- } catch (error) {
104
- if (error instanceof PipelineError) throw error;
105
- invalid("Feedback import is unreadable or is not valid UTF-8 JSON.");
106
- } finally {
107
- if (fd !== void 0) closeSync(fd);
108
- }
109
- }
110
- function originalBundles(file, current) {
111
- return { file, current, cache: /* @__PURE__ */ new Map([[current.revision, current]]) };
112
- }
113
- function originalBundle(bundles, reviewOf, revisionId) {
114
- if (!/^[a-f0-9]{64}$/u.test(reviewOf ?? ""))
115
- invalid("Feedback has an invalid original artifact digest.");
116
- const load = (revision) => {
117
- if (!bundles.cache.has(revision)) {
118
- try {
119
- const historical = readDesignRevision(bundles.file, revision);
120
- bundles.cache.set(revision, { ...historical, document: historical.design });
121
- } catch {
122
- invalid(
123
- "The original feedback revision is unavailable. Restore its immutable render bundle before importing."
124
- );
125
- }
126
- }
127
- const bundle = bundles.cache.get(revision);
128
- if (bundle.document.id !== bundles.current.document.id)
129
- invalid("Feedback revision belongs to another design document.");
130
- return bundle;
131
- };
132
- if (revisionId && /^[a-f0-9]{64}$/u.test(revisionId)) {
133
- const exact = load(revisionId);
134
- if (digestArtifactEnvelope(exact.envelope) !== reviewOf)
135
- invalid("Feedback revision does not match its original artifact digest.");
136
- return exact;
137
- }
138
- for (const bundle of bundles.cache.values())
139
- if (digestArtifactEnvelope(bundle.envelope) === reviewOf) return bundle;
140
- for (const { revision } of listDesignRevisions(bundles.file).revisions) {
141
- const bundle = load(revision);
142
- if (digestArtifactEnvelope(bundle.envelope) === reviewOf) return bundle;
143
- }
144
- invalid(
145
- "The original feedback revision is unavailable. Restore its immutable render bundle before importing."
146
- );
147
- }
148
- function validatePin(pin, bundle) {
149
- const entry = bundle.entries.find((value) => value.artifactId === pin.artifactId);
150
- const frame = bundle.document.frames.find((value) => value.id === entry?.frameId);
151
- const screen = bundle.document.screens.find((value) => value.id === entry?.screenId);
152
- if (!entry || !matchesDesignFrame(frame, pin.viewport))
153
- invalid("Feedback pin does not match its original screen and captured frame.");
154
- if (pin.variant !== void 0 && pin.variant !== entry.variantId)
155
- invalid("Feedback pin targets another design direction.");
156
- if (pin.region.x + pin.region.w > 1.000001 || pin.region.y + pin.region.h > 1.000001)
157
- invalid("Feedback pin region extends beyond its original viewport or anchor.");
158
- if (pin.anchor && (pin.anchor.screen !== void 0 && pin.anchor.screen !== entry.screenId || pin.anchor.planrId !== screen.id && !screen.anchors?.includes(pin.anchor.planrId)))
159
- invalid("Feedback pin anchor is not declared in its original screen.");
160
- }
161
- function identity(value) {
162
- return { name: value?.name, ...value?.id == null ? {} : { id: value.id } };
163
- }
164
- function projectedPin(thread, group, bundle) {
165
- const source = thread.source;
166
- if (!source || source.reviewId !== group.reviewId || source.reviewOf !== group.reviewOf || source.artifactId !== group.artifactId || source.revisionId !== group.sourceRevisionId)
167
- invalid("Feedback thread and group have conflicting source identities.");
168
- const entry = bundle.entries.find((value) => value.artifactId === group.artifactId);
169
- if (!entry || entry.screenId !== group.screen?.id || entry.variantId !== group.direction?.id || entry.frameId !== group.frame?.id)
170
- invalid("Feedback group has an invalid original screen mapping.");
171
- const location = thread.location;
172
- if (!location || !["anchor-normalized", "viewport-normalized"].includes(location.coordinateSpace) || Boolean(location.anchor) !== (location.coordinateSpace === "anchor-normalized"))
173
- invalid("Feedback location has an invalid coordinate space.");
174
- if (!Array.isArray(thread.replies)) invalid("Feedback replies must be an array.");
175
- const pin = {
176
- id: thread.id,
177
- artifactId: source.artifactId,
178
- author: identity(thread.author),
179
- intent: thread.originalIntent,
180
- status: thread.status,
181
- comment: thread.comment,
182
- region: location.region,
183
- viewport: location.capturedViewport,
184
- ...location.anchor ? {
185
- anchor: {
186
- planrId: location.anchor.planrId,
187
- ...location.anchor.screen == null ? {} : { screen: location.anchor.screen }
188
- }
189
- } : {},
190
- createdAt: thread.createdAt,
191
- updatedAt: thread.updatedAt,
192
- replies: thread.replies.map((reply) => ({ ...reply, author: identity(reply.author) }))
193
- };
194
- return pin;
195
- }
196
- function appendProjectedThread(entry, thread, group, bundle, stored) {
197
- const pin = projectedPin(thread, group, bundle);
198
- const previousPin = stored?.reviews.find((value) => value.review.reviewId === group.reviewId)?.review.pins.find((value) => value.id === pin.id);
199
- if (previousPin?.variant !== void 0) pin.variant = previousPin.variant;
200
- entry.review.pins.push(pin);
201
- if (!entry.review.updatedAt || Date.parse(pin.updatedAt) > Date.parse(entry.review.updatedAt))
202
- entry.review.updatedAt = pin.updatedAt;
203
- entry.stale ||= thread.stale === true;
204
- }
205
- function decodeProjection(value, current, bundles, stored) {
206
- if (value.schemaVersion !== "1.0.0" || value.design?.id !== current.document.id || !Array.isArray(value.groups) || value.groups.length > 1e4 || !Array.isArray(value.overallNotes) || value.overallNotes.length > 1e4)
207
- invalid("Feedback export does not match this design document or supported schema.");
208
- originalBundle(bundles, value.currentArtifactDigest, value.currentRevisionId);
209
- const reviews = /* @__PURE__ */ new Map();
210
- const reviewFor = (reviewId, reviewOf) => {
211
- if (typeof reviewId !== "string" || !reviewId || reviewId.length > 128)
212
- invalid("Feedback export is missing its original review identity.");
213
- const previous = reviews.get(reviewId);
214
- if (previous && previous.review.reviewOf !== reviewOf)
215
- invalid("Feedback review identity is bound to conflicting artifact digests.");
216
- if (previous) return previous;
217
- const existing = stored?.reviews.find((entry2) => entry2.review.reviewId === reviewId)?.review;
218
- const entry = {
219
- review: {
220
- schemaVersion: "1.0.0",
221
- reviewId,
222
- reviewOf,
223
- decision: "pending",
224
- overall: "",
225
- pins: [],
226
- ...existing?.createdAt ? { createdAt: existing.createdAt } : {},
227
- ...existing?.updatedAt ? { updatedAt: existing.updatedAt } : {}
228
- },
229
- stale: false
230
- };
231
- reviews.set(reviewId, entry);
232
- return entry;
233
- };
234
- for (const group of value.groups) {
235
- if (!group || !Array.isArray(group.threads) || group.threads.length > 1e4 || group.sourceMapping !== "original-bundle")
236
- invalid("Feedback export lacks its original thread mapping.");
237
- const bundle = originalBundle(bundles, group.reviewOf, group.sourceRevisionId);
238
- const entry = reviewFor(group.reviewId, group.reviewOf);
239
- for (const thread of group.threads) appendProjectedThread(entry, thread, group, bundle, stored);
240
- }
241
- for (const note of value.overallNotes) {
242
- originalBundle(bundles, note?.reviewOf);
243
- const entry = reviewFor(note?.reviewId, note?.reviewOf);
244
- if (entry.review.overall) invalid("Feedback export contains duplicate overall notes.");
245
- entry.review.overall = note.comment;
246
- }
247
- return [...reviews.values()].map((entry) => ({
248
- ...entry,
249
- review: normalizeArtifactReview(entry.review)
250
- }));
251
- }
252
- function rejectLegacy(value) {
253
- if (value?.kind === "openplanr-design-review-export" || value?.kind === "artifact-review-state" || value?.artifacts || value?.reviewId || value?.review)
254
- return;
255
- invalid(
256
- "Legacy notes.json is not canonical review feedback. Keep the file and re-export JSON from the original supported Studio; it cannot be converted safely without its revision and anchor mapping."
257
- );
258
- }
259
- function rebaseLedger(stored, artifactId, digest) {
260
- if (stored && stored.artifactId !== artifactId)
261
- invalid("Stored feedback belongs to another design document.");
262
- return createReviewLedger({
263
- artifactId,
264
- currentReviewOf: digest,
265
- reviews: (stored?.reviews ?? []).map((entry) => ({
266
- ...entry,
267
- stale: entry.stale || entry.review.reviewOf !== digest
268
- }))
269
- });
270
- }
271
- function mergeImportedEntries(stored, artifactId, digest, entries, bundles, allowStale) {
272
- let ledger = rebaseLedger(stored, artifactId, digest);
273
- const imported = [];
274
- for (const entry of entries) {
275
- const bundle = originalBundle(bundles, entry.review.reviewOf);
276
- for (const pin of entry.review.pins) validatePin(pin, bundle);
277
- const stale = entry.stale || entry.review.reviewOf !== digest;
278
- if (stale && !allowStale)
279
- invalid(
280
- "Feedback belongs to an earlier revision. Inspect it and retry with explicit --allow-stale confirmation.",
281
- ARTIFACT_ERROR_CODES.STALE_REVIEW
282
- );
283
- const previous = ledger.reviews.find(
284
- (value) => value.review.reviewId === entry.review.reviewId
285
- )?.review;
286
- const review = { ...entry.review, decision: previous?.decision ?? "pending" };
287
- ledger = mergeReviewLedger(ledger, review, { stale });
288
- imported.push({ reviewId: review.reviewId, stale, pins: review.pins.length });
289
- }
290
- return { ledger, imported };
291
- }
292
- async function importDesignFeedback(file, { input, revision, allowStale = false, env = process.env } = {}) {
293
- if (!/^[a-f0-9]{64}$/u.test(revision ?? ""))
294
- invalid("Feedback import requires the current render revision from feedback inspect.");
295
- if (typeof allowStale !== "boolean")
296
- invalid("Stale feedback requires an explicit boolean confirmation.");
297
- const source = readDesignFeedbackImport(input);
298
- rejectLegacy(source);
299
- const initial = currentDesign(file);
300
- const release = await acquireStartLock(join(initial.root, ".design/render.lock"), {
301
- timeout: 1e3,
302
- stale: 3e4
303
- });
304
- try {
305
- const current = currentDesign(file);
306
- if (current.revision !== revision)
307
- invalid(
308
- "The design changed before feedback import. Inspect the current revision and retry.",
309
- ARTIFACT_ERROR_CODES.STALE_REVIEW
310
- );
311
- const artifactId = `design-${hash(current.document.id).slice(0, 24)}`;
312
- const path = resolveArtifactReviewDestination({ cwd: current.root, env, artifactId }).path;
313
- return await withArtifactReviewLock(path, async () => {
314
- const stored = readArtifactReviewState(path, { allowMissing: true });
315
- const bundles = originalBundles(file, current);
316
- const entries = source.kind === "openplanr-design-review-export" ? decodeProjection(source, current, bundles, stored) : await decodeArtifactReviewSources(source, { withMetadata: true });
317
- if (source.kind === "artifact-review-state" && source.artifactId !== artifactId)
318
- invalid("Imported ledger belongs to another design document.");
319
- const digest = digestArtifactEnvelope(current.envelope);
320
- const { ledger, imported } = mergeImportedEntries(
321
- stored,
322
- artifactId,
323
- digest,
324
- entries,
325
- bundles,
326
- allowStale
327
- );
328
- writeArtifactReviewState(path, ledger);
329
- return {
330
- ok: true,
331
- action: "design_feedback_imported",
332
- revision: current.revision,
333
- imported,
334
- note: "Feedback merged. Imported votes, dispositions and decisions do not change owner selection or handoff approval."
335
- };
336
- });
337
- } finally {
338
- release();
339
- }
340
- }
341
-
342
- // packages/design/lib/design/font-fetch.mjs
343
- import {
344
- chmodSync,
345
- existsSync,
346
- mkdirSync,
347
- mkdtempSync,
348
- readdirSync,
349
- renameSync,
350
- rmdirSync,
351
- rmSync,
352
- statSync,
353
- writeFileSync
354
- } from "node:fs";
355
- import { dirname, join as join2, resolve as resolve2 } from "node:path";
356
- var MAX_FAMILIES = 2;
357
- var MAX_WEIGHTS = 3;
358
- var TIMEOUT_MS = 2e4;
359
- var MAX_FILE_BYTES = 15e5;
360
- var MAX_TOTAL_BYTES = 5e6;
361
- var CSS_ENDPOINT = "https://fonts.googleapis.com/css2";
362
- var FONT_ORIGIN = "https://fonts.gstatic.com/";
363
- var CATALOG_ROOT = "https://raw.githubusercontent.com/google/fonts/main";
364
- var USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36";
365
- var LICENSES = Object.freeze([
366
- {
367
- directory: "ofl",
368
- metadata: "OFL",
369
- file: "OFL.txt",
370
- id: "OFL-1.1",
371
- text: /SIL Open Font License,?\s+Version 1\.1/iu
372
- },
373
- {
374
- directory: "apache",
375
- metadata: "APACHE2",
376
- file: "LICENSE.txt",
377
- id: "Apache-2.0",
378
- text: /Apache License\s+Version 2\.0/iu
379
- }
380
- ]);
381
- var FAMILY_SPEC = /^([A-Za-z0-9](?:[A-Za-z0-9 ]*[A-Za-z0-9])?):(\d{3}(?:,\d{3})*)$/u;
382
- function parseFontFamily(spec) {
383
- const match = typeof spec === "string" ? FAMILY_SPEC.exec(spec.trim()) : null;
384
- if (!match)
385
- throw new Error(
386
- `--family ${JSON.stringify(spec ?? "")} must look like "Inter:400,600" (a name, a colon, comma-separated weights).`
387
- );
388
- const weights = [...new Set(match[2].split(",").map(Number))].sort((a, b) => a - b);
389
- const invalid2 = weights.find((weight) => weight < 100 || weight > 900 || weight % 100 !== 0);
390
- if (invalid2 !== void 0)
391
- throw new Error(`--family "${spec}" has weight ${invalid2}; use 100 to 900 in steps of 100.`);
392
- if (weights.length > MAX_WEIGHTS)
393
- throw new Error(
394
- `--family "${spec}" has ${weights.length} weights; at most ${MAX_WEIGHTS} per family.`
395
- );
396
- return { family: match[1], weights };
397
- }
398
- function latinFontFaces(css, family) {
399
- const faces = [];
400
- for (const [, subset, body] of css.matchAll(
401
- /\/\*\s*([\w-]+)\s*\*\/\s*@font-face\s*\{([^}]*)\}/gu
402
- )) {
403
- const value = (name) => new RegExp(`(?:^|;)\\s*${name}\\s*:\\s*([^;]+)`, "iu").exec(body)?.[1].trim();
404
- if (subset !== "latin" || !/^U\+0000-00FF\b/iu.test(value("unicode-range") ?? "")) continue;
405
- const source = /^url\(([^)\s]+)\)\s*format\(['"]woff2['"]\)$/u.exec(value("src") ?? "");
406
- if (!source?.[1].startsWith(FONT_ORIGIN))
407
- throw new Error(
408
- `"${family}" Latin face is not a woff2 file on ${FONT_ORIGIN}: ${value("src")}`
409
- );
410
- faces.push({ weight: Number(value("font-weight")), url: source[1] });
411
- }
412
- return faces;
413
- }
414
- async function request(fetchImpl, url, { headers, allowMissing = false, redirect } = {}) {
415
- let response;
416
- try {
417
- response = await fetchImpl(url, {
418
- headers,
419
- redirect,
420
- signal: AbortSignal.timeout(TIMEOUT_MS)
421
- });
422
- } catch (error) {
423
- const reason = error?.name === "TimeoutError" ? `no response within ${TIMEOUT_MS / 1e3} s` : error?.message;
424
- throw new Error(`Font fetch failed: ${url}: ${reason}`);
425
- }
426
- if (allowMissing && response.status === 404) return null;
427
- if (!response.ok) throw new Error(`Font fetch failed: ${url}: HTTP ${response.status}`);
428
- return response;
429
- }
430
- async function verifiedLicense(fetchImpl, family) {
431
- const slug = family.toLowerCase().replace(/[^a-z0-9]/gu, "");
432
- const tried = [];
433
- for (const license of LICENSES) {
434
- const base = `${CATALOG_ROOT}/${license.directory}/${slug}`;
435
- tried.push(`${base}/METADATA.pb`);
436
- const metadata = await request(fetchImpl, `${base}/METADATA.pb`, { allowMissing: true });
437
- if (!metadata) continue;
438
- const text = await metadata.text();
439
- const name = /^name:\s*"([^"]*)"/mu.exec(text)?.[1];
440
- const declared = /^license:\s*"([^"]*)"/mu.exec(text)?.[1];
441
- if (name !== family && name?.toLowerCase() === family.toLowerCase())
442
- throw new Error(`"${family}" is listed as "${name}"; use the catalog name "${name}".`);
443
- if (name !== family || declared !== license.metadata)
444
- throw new Error(
445
- `"${family}" is not verified as ${license.id}: ${base}/METADATA.pb names ${JSON.stringify(name)} with license ${JSON.stringify(declared)}. Use the system stack.`
446
- );
447
- const body = Buffer.from(
448
- await (await request(fetchImpl, `${base}/${license.file}`, { redirect: "error" })).arrayBuffer()
449
- );
450
- if (!license.text.test(body.toString("utf8")))
451
- throw new Error(
452
- `"${family}" is not verified as ${license.id}: ${base}/${license.file} does not contain the license text. Use the system stack.`
453
- );
454
- return { slug, license, body };
455
- }
456
- throw new Error(
457
- `"${family}" is not an OFL or Apache licensed Google Fonts family (checked ${tried.join(", ")}). Use the system stack.`
458
- );
459
- }
460
- async function download(fetchImpl, url) {
461
- const bytes = Buffer.from(
462
- await (await request(fetchImpl, url, { redirect: "error" })).arrayBuffer()
463
- );
464
- if (bytes.length > MAX_FILE_BYTES)
465
- throw new Error(`Font file is ${bytes.length} bytes, over the ${MAX_FILE_BYTES} limit: ${url}`);
466
- if (bytes.toString("latin1", 0, 4) !== "wOF2") throw new Error(`Font file is not woff2: ${url}`);
467
- return bytes;
468
- }
469
- function assertWritableDestination(dest) {
470
- if (!existsSync(dest)) return;
471
- if (!statSync(dest).isDirectory() || readdirSync(dest).length > 0)
472
- throw new Error(
473
- `Font destination already exists and is not empty: ${dest}. Choose a new --dest or remove it.`
474
- );
475
- }
476
- function faceRule(family, weights, file) {
477
- const weight = weights.length > 1 ? `${weights[0]} ${weights.at(-1)}` : `${weights[0]}`;
478
- return `@font-face {
479
- font-family: "${family}";
480
- font-style: normal;
481
- font-weight: ${weight};
482
- font-display: swap;
483
- src: url("${file}") format("woff2");
484
- }
485
- `;
486
- }
487
- async function fetchDesignFonts({ families, dest, fetchImpl = fetch }) {
488
- if (!dest) throw new Error("fonts fetch requires --dest <design>/source/assets/fonts.");
489
- const specs = (families ?? []).map(parseFontFamily);
490
- if (specs.length === 0)
491
- throw new Error('fonts fetch requires at least one --family "<Name>:<weights>".');
492
- if (specs.length > MAX_FAMILIES)
493
- throw new Error(
494
- `${specs.length} families requested (${specs.map(({ family }) => family).join(", ")}); at most ${MAX_FAMILIES}.`
495
- );
496
- const names = specs.map(({ family }) => family.toLowerCase());
497
- if (new Set(names).size !== names.length)
498
- throw new Error(
499
- `--family names a family twice: ${specs.map(({ family }) => family).join(", ")}.`
500
- );
501
- const target = resolve2(dest);
502
- assertWritableDestination(target);
503
- const files = /* @__PURE__ */ new Map();
504
- const rules = [];
505
- const summaries = [];
506
- let totalBytes = 0;
507
- const add = (path, bytes) => {
508
- totalBytes += bytes.length;
509
- if (totalBytes > MAX_TOTAL_BYTES)
510
- throw new Error(`Font snapshot exceeds ${MAX_TOTAL_BYTES} bytes at ${path}.`);
511
- files.set(path, bytes);
512
- };
513
- for (const { family, weights } of specs) {
514
- const { slug, license, body } = await verifiedLicense(fetchImpl, family);
515
- const source = `${CSS_ENDPOINT}?family=${encodeURIComponent(family).replaceAll("%20", "+")}:wght@${weights.join(";")}&display=swap`;
516
- const css = await (await request(fetchImpl, source, { headers: { "user-agent": USER_AGENT } })).text();
517
- const faces = latinFontFaces(css, family);
518
- const byUrl = /* @__PURE__ */ new Map();
519
- for (const weight of weights) {
520
- const face = faces.find((item) => item.weight === weight);
521
- if (!face)
522
- throw new Error(`"${family}" has no Latin woff2 face for weight ${weight} in ${source}`);
523
- byUrl.set(face.url, [...byUrl.get(face.url) ?? [], weight]);
524
- }
525
- rules.push(`/* ${family} (${license.id}, ${slug}/${license.file}): ${source} */
526
- `);
527
- for (const [url, covered] of byUrl) {
528
- const range = covered.length > 1 ? `${covered[0]}-${covered.at(-1)}` : `${covered[0]}`;
529
- const file = `${slug}/${slug}-${range}-latin.woff2`;
530
- add(file, await download(fetchImpl, url));
531
- rules.push(faceRule(family, covered, file));
532
- }
533
- add(`${slug}/${license.file}`, body);
534
- summaries.push({
535
- family,
536
- license: license.id,
537
- weights,
538
- source,
539
- licenseFile: `${slug}/${license.file}`
540
- });
541
- }
542
- add("fonts.css", Buffer.from(rules.join("")));
543
- mkdirSync(dirname(target), { recursive: true });
544
- const staging = mkdtempSync(join2(dirname(target), ".fonts-fetch-"));
545
- try {
546
- for (const [path, bytes] of files) {
547
- mkdirSync(dirname(join2(staging, path)), { recursive: true });
548
- writeFileSync(join2(staging, path), bytes, { flag: "wx" });
549
- }
550
- assertWritableDestination(target);
551
- if (existsSync(target)) rmdirSync(target);
552
- chmodSync(staging, 493);
553
- renameSync(staging, target);
554
- } catch (error) {
555
- rmSync(staging, { recursive: true, force: true });
556
- throw error;
557
- }
558
- return {
559
- ok: true,
560
- dest: target,
561
- css: join2(target, "fonts.css"),
562
- families: summaries,
563
- files: [...files].map(([path, bytes]) => ({ path, bytes: bytes.length })),
564
- totalBytes
565
- };
566
- }
567
-
568
- // packages/design/lib/design/studio-lifecycle.mjs
569
- import { join as join3 } from "node:path";
570
- function localUrl(value, service, path) {
571
- if (typeof value !== "string") return null;
572
- try {
573
- const url = new URL(value);
574
- return url.origin === `http://127.0.0.1:${service.port}` && !url.search && !url.hash && path.test(url.pathname) ? url.href : null;
575
- } catch {
576
- return null;
577
- }
578
- }
579
- async function manageDesignStudio(file, { action = "status", instanceId, env = process.env, fetchImpl = fetch } = {}) {
580
- if (!["status", "stop"].includes(action))
581
- throw new Error("Studio action must be status or stop.");
582
- if (instanceId !== void 0 && (typeof instanceId !== "string" || !/^[A-Za-z0-9_-]{22}$/u.test(instanceId)))
583
- throw new Error("Studio requires a valid exact instance ID.");
584
- const current = currentDesign(file);
585
- const services = (await listArtifactReviewServers({ env, fetchImpl })).filter(
586
- (service2) => service2.kind === "design" && service2.projectRoot === current.root
587
- );
588
- const launcher = readJson(join3(current.root, ".design/server.json"), null);
589
- let service = services.find((value) => value.instanceId === (instanceId ?? launcher?.instanceId));
590
- if (instanceId !== void 0 && !service)
591
- throw new Error(
592
- "That Studio instance is not owned by this design in the current state directory."
593
- );
594
- const result = {
595
- ok: true,
596
- action: `design_studio_${action}`,
597
- documentId: current.document.id,
598
- revision: current.revision,
599
- verification: current.verification.status
600
- };
601
- if (action === "stop") {
602
- if (!service && services.length === 1) service = services[0];
603
- if (!service && services.length > 1)
604
- throw new Error(
605
- `Multiple owned Studio services need recovery. Run studio --action status, then stop an exact service with --instance-id. Owned instances: ${services.map((value) => value.instanceId).join(", ")}.`
606
- );
607
- if (!service)
608
- return {
609
- ...result,
610
- status: "stopped",
611
- notice: "Studio is stopped. Open the design to start it again."
612
- };
613
- const stopped = await stopArtifactReviewServer(service.instanceId, { env, fetchImpl });
614
- return {
615
- ...result,
616
- status: stopped.status,
617
- instanceId: service.instanceId,
618
- notice: "Feedback and arrangement are saved. Open the design to start Studio again."
619
- };
620
- }
621
- if (!service)
622
- return {
623
- ...result,
624
- status: services.length ? "attention" : "stopped",
625
- services,
626
- notice: services.length ? services.length === 1 ? "Stop this design\u2019s owned Studio service, then open the design again to restore its session link." : "Stop an exact owned Studio service with --instance-id, then reopen after all obsolete services are stopped." : "Open the design to start Studio."
627
- };
628
- const url = localUrl(launcher?.studioUrl, service, /^\/studio\/[A-Za-z0-9._-]+\/$/u) ?? service.url;
629
- let browserStatus = "not-checked";
630
- const privateUrl = localUrl(launcher?.url, service, /^\/r\/[A-Za-z0-9_-]+\/[A-Za-z0-9_-]+\/$/u);
631
- if (privateUrl) {
632
- try {
633
- const response = await fetchImpl(`${privateUrl}api/design-status`, {
634
- signal: AbortSignal.timeout(700)
635
- });
636
- const data = await response.json();
637
- if (response.ok && data.documentId === current.document.id && data.revision === current.revision && ["loading", "ready", "failed"].includes(data.status))
638
- browserStatus = data.status;
639
- } catch {
640
- }
641
- }
642
- return {
643
- ...result,
644
- status: "running",
645
- instanceId: service.instanceId,
646
- url,
647
- browserStatus,
648
- services
649
- };
650
- }
651
-
652
- // packages/design/lib/design/browser-audit.mjs
653
- function auditRenderedScreen({ height, frameBoundsSeverity = "warning" } = {}) {
654
- const issues = [];
655
- const add = (rule, severity, message) => issues.push({ rule, severity, message });
656
- const label = (node) => node.getAttribute("data-planr-id") || node.id || `${node.tagName.toLowerCase()} \u201C${(node.textContent || node.getAttribute("aria-label") || "").trim().replace(/\s+/gu, " ").slice(0, 60)}\u201D`;
657
- const viewport = { width: window.innerWidth, height: window.innerHeight };
658
- const screenId = document.body?.getAttribute("data-planr-screen") ?? null;
659
- if (!screenId)
660
- add("screen-not-loaded", "error", "The frame has no authored design screen identity.");
661
- if (document.readyState !== "complete")
662
- add("screen-loading", "error", `The frame is still ${document.readyState}.`);
663
- const documentHeight = document.documentElement.scrollHeight;
664
- if (document.body && getComputedStyle(document.body).boxSizing !== "border-box")
665
- add(
666
- "board-root-box-sizing",
667
- frameBoundsSeverity,
668
- "The screen root body must use box-sizing: border-box."
669
- );
670
- if (height !== "auto" && documentHeight > viewport.height + 1)
671
- add(
672
- "vertical-overflow",
673
- frameBoundsSeverity,
674
- `The screen is ${documentHeight}px tall in a ${viewport.height}px frame.`
675
- );
676
- const nodes = [...document.querySelectorAll("body *")];
677
- if (nodes.length > 5e3)
678
- add(
679
- "audit-limit",
680
- "error",
681
- "The screen exceeds the 5,000 element audit limit; inspect and split the screen before verification."
682
- );
683
- const canvas = document.createElement("canvas");
684
- canvas.width = canvas.height = 1;
685
- const context = canvas.getContext("2d", { willReadFrequently: true });
686
- const color = (input) => {
687
- if (!context) return null;
688
- context.clearRect(0, 0, 1, 1);
689
- context.fillStyle = input;
690
- context.fillRect(0, 0, 1, 1);
691
- return [...context.getImageData(0, 0, 1, 1).data].map((value) => value / 255);
692
- };
693
- const over = (foreground, background) => foreground.slice(0, 3).map((value, index) => value * foreground[3] + background[index] * (1 - foreground[3]));
694
- const luminance = (rgb) => rgb.reduce(
695
- (sum, value, index) => sum + [0.2126, 0.7152, 0.0722][index] * (value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4),
696
- 0
697
- );
698
- const effectiveBackground = (node) => {
699
- const chain = [];
700
- for (let ancestor = node; ancestor; ancestor = ancestor.parentElement) chain.unshift(ancestor);
701
- let background = [1, 1, 1];
702
- for (const ancestor of chain) {
703
- const style = getComputedStyle(ancestor);
704
- if (style.backgroundImage !== "none" || Number(style.opacity) < 1 || style.mixBlendMode !== "normal" || style.filter !== "none")
705
- return null;
706
- const resolved = color(style.backgroundColor);
707
- if (!resolved) return null;
708
- background = over(resolved, background);
709
- }
710
- return background;
711
- };
712
- const visible = (node) => {
713
- const rect = node.getBoundingClientRect();
714
- const style = getComputedStyle(node);
715
- return rect.width > 0 && rect.height > 0 && !node.closest('[hidden],[aria-hidden="true"],[inert]') && style.visibility !== "hidden" && style.visibility !== "collapse" && Number(style.opacity) > 0;
716
- };
717
- let checkedElements = 0, checkedContrast = 0, skippedContrast = 0, checkedFocus = 0;
718
- const focusTargets = [];
719
- for (const node of nodes.slice(0, 5e3)) {
720
- const style = getComputedStyle(node);
721
- const rect = node.getBoundingClientRect();
722
- if (rect.width > 0 && rect.height > 0 && style.visibility !== "hidden" && style.visibility !== "collapse" && Number(style.opacity) > 0 && ["absolute", "fixed"].includes(style.position)) {
723
- let { left, right, top, bottom } = rect;
724
- for (let ancestor = node.parentElement; ancestor && ancestor !== document.body; ancestor = ancestor.parentElement) {
725
- const clip = getComputedStyle(ancestor);
726
- const bounds = ancestor.getBoundingClientRect();
727
- if (["auto", "scroll", "hidden", "clip"].includes(clip.overflowX)) {
728
- left = Math.max(left, bounds.left + ancestor.clientLeft);
729
- right = Math.min(right, bounds.left + ancestor.clientLeft + ancestor.clientWidth);
730
- }
731
- if (["auto", "scroll", "hidden", "clip"].includes(clip.overflowY)) {
732
- top = Math.max(top, bounds.top + ancestor.clientTop);
733
- bottom = Math.min(bottom, bounds.top + ancestor.clientTop + ancestor.clientHeight);
734
- }
735
- }
736
- if (right > left && bottom > top && (left < -1 || right > viewport.width + 1 || top < -1 || bottom > (height === "auto" ? documentHeight : viewport.height) + 1))
737
- add(
738
- "outside-frame",
739
- frameBoundsSeverity,
740
- `${label(node)} is positioned outside the frame box.`
741
- );
742
- }
743
- if (!visible(node)) continue;
744
- checkedElements += 1;
745
- const directText = [...node.childNodes].some(
746
- (child) => child.nodeType === 3 && child.textContent.trim()
747
- );
748
- if (node.tagName === "IMG" && (!node.complete || node.naturalWidth === 0))
749
- add("missing-image", "error", `${label(node)} has not loaded its image.`);
750
- if (directText) {
751
- const background = effectiveBackground(node);
752
- const foreground = color(style.color);
753
- if (background && foreground) {
754
- const a = luminance(over(foreground, background)), b = luminance(background);
755
- const ratio = (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);
756
- const large = parseFloat(style.fontSize) >= 24 || parseFloat(style.fontSize) >= 18.666 && parseFloat(style.fontWeight) >= 700;
757
- const required = large ? 3 : 4.5;
758
- checkedContrast += 1;
759
- if (ratio + 0.01 < required)
760
- add(
761
- "contrast-below-aa",
762
- "error",
763
- `${label(node)} has computed contrast ${ratio.toFixed(2)}:1; ${required}:1 is required.`
764
- );
765
- } else skippedContrast += 1;
766
- if (!["INPUT", "TEXTAREA", "SELECT", "OPTION"].includes(node.tagName)) {
767
- const clipsX = ["hidden", "clip"].includes(style.overflowX) && node.scrollWidth > node.clientWidth + 1;
768
- const clipsY = ["hidden", "clip"].includes(style.overflowY) && node.scrollHeight > node.clientHeight + 1;
769
- if (clipsX || clipsY) {
770
- const intentional = style.textOverflow === "ellipsis" || style.webkitLineClamp && style.webkitLineClamp !== "none";
771
- add(
772
- "clipped-content",
773
- intentional ? "warning" : "error",
774
- `${label(node)} clips ${clipsX ? "horizontal" : "vertical"} text${intentional ? "; confirm intentional truncation in the screenshot" : ""}.`
775
- );
776
- }
777
- }
778
- }
779
- if (node.tabIndex >= 0 && !node.disabled && node.matches(
780
- 'button,a[href],input:not([type="hidden"]),select,textarea,[tabindex],[contenteditable="true"]'
781
- )) {
782
- focusTargets.push(node);
783
- const name = node.getAttribute("aria-label") || (node.getAttribute("aria-labelledby") || "").split(/\s+/u).map((id) => document.getElementById(id)?.textContent || "").join(" ").trim() || [...node.labels || []].map((item) => item.textContent).join(" ").trim() || node.getAttribute("title") || (node.matches('input[type="button"],input[type="submit"],input[type="reset"]') ? node.value : node.matches("input,select,textarea") ? "" : node.textContent.trim());
784
- if (!name) add("unnamed-control", "error", `${label(node)} has no accessible name.`);
785
- }
786
- }
787
- if (document.documentElement.scrollWidth > viewport.width + 1)
788
- add(
789
- "horizontal-overflow",
790
- "error",
791
- `The screen is ${document.documentElement.scrollWidth}px wide in a ${viewport.width}px frame.`
792
- );
793
- if (checkedElements === 0)
794
- add("empty-render", "error", "The frame contains no visible rendered content.");
795
- if (skippedContrast > 0)
796
- add(
797
- "contrast-needs-inspection",
798
- "warning",
799
- `${skippedContrast} text elements use images, blending or transparency effects; inspect their screenshot contrast.`
800
- );
801
- if (document.fonts?.status === "loading")
802
- add("fonts-loading", "error", "Fonts are still loading; inspect again after they settle.");
803
- const previousFocus = document.activeElement;
804
- const previousScroll = { x: window.scrollX, y: window.scrollY };
805
- let keyboardInspectionNeeded = 0;
806
- for (const node of focusTargets.slice(0, 150)) {
807
- const before = getComputedStyle(node);
808
- const baseline = [
809
- before.boxShadow,
810
- before.backgroundColor,
811
- before.borderColor,
812
- before.textDecorationLine
813
- ];
814
- node.focus({ preventScroll: true });
815
- if (document.activeElement !== node) {
816
- add("unreachable-control", "error", `${label(node)} cannot receive focus.`);
817
- continue;
818
- }
819
- if (!node.matches(":focus-visible")) {
820
- keyboardInspectionNeeded += 1;
821
- continue;
822
- }
823
- const focused = getComputedStyle(node);
824
- const outlined = focused.outlineStyle !== "none" && parseFloat(focused.outlineWidth) > 0 && (color(focused.outlineColor)?.[3] ?? 0) > 0;
825
- const changed = [
826
- focused.boxShadow,
827
- focused.backgroundColor,
828
- focused.borderColor,
829
- focused.textDecorationLine
830
- ].some((value, index) => value !== baseline[index]);
831
- checkedFocus += 1;
832
- if (!outlined && !changed)
833
- add(
834
- "missing-focus-indicator",
835
- "error",
836
- `${label(node)} has no visible keyboard focus style.`
837
- );
838
- }
839
- previousFocus?.focus?.({ preventScroll: true });
840
- if (document.activeElement !== previousFocus) document.activeElement?.blur?.();
841
- if (window.scrollX !== previousScroll.x || window.scrollY !== previousScroll.y)
842
- window.scrollTo(previousScroll.x, previousScroll.y);
843
- if (keyboardInspectionNeeded > 0)
844
- add(
845
- "focus-needs-keyboard-inspection",
846
- "warning",
847
- `${keyboardInspectionNeeded} controls need a keyboard focus walkthrough.`
848
- );
849
- if (focusTargets.length > 150)
850
- add("focus-audit-limit", "warning", "Only the first 150 focusable controls were inspected.");
851
- return {
852
- screenId,
853
- viewport,
854
- checkedElements,
855
- checkedContrast,
856
- skippedContrast,
857
- checkedFocus,
858
- issues
859
- };
860
- }
861
- async function attachedArtifactFrame(page, artifactId, warn) {
862
- const deadline = Date.now() + 5e3;
863
- const escaped = artifactId.replace(
864
- /[^a-z0-9_-]/giu,
865
- (char) => `\\${char.codePointAt(0).toString(16)} `
866
- );
867
- const handle = await page.waitForSelector(
868
- `iframe[data-planr-artifact-frame="${escaped}"], iframe[data-planr-artifact-id="${escaped}"]`,
869
- { state: "attached", timeout: 5e3 }
870
- );
871
- try {
872
- return await new Promise((resolve4, reject) => {
873
- let settled = false;
874
- const finish = (error, frame) => {
875
- if (settled) return;
876
- settled = true;
877
- clearTimeout(timer);
878
- page.off("frameattached", inspect);
879
- page.off("framenavigated", inspect);
880
- if (error) reject(error);
881
- else resolve4(frame);
882
- };
883
- const inspect = async (frame) => {
884
- if (settled || frame === page.mainFrame?.()) return;
885
- try {
886
- const candidate = await frame.frameElement();
887
- let matches;
888
- try {
889
- matches = await handle.evaluate((element, other) => element === other, candidate);
890
- } finally {
891
- await candidate.dispose?.();
892
- }
893
- if (matches) finish(null, frame);
894
- } catch (error) {
895
- if (!settled) warn(error);
896
- }
897
- };
898
- const timer = setTimeout(
899
- () => finish(new Error(`No frame attached for artifact ${artifactId} within 5000ms.`)),
900
- Math.max(1, deadline - Date.now())
901
- );
902
- page.on("frameattached", inspect);
903
- page.on("framenavigated", inspect);
904
- handle.contentFrame().then((frame) => {
905
- if (frame) finish(null, frame);
906
- }, finish);
907
- });
908
- } finally {
909
- await handle.dispose?.();
910
- }
911
- }
912
- async function auditDesignPage(page, { revision, document: document2, entries = [], screenshotPaths = [], scenarios = [] } = {}) {
913
- if (!document2 || typeof document2 !== "object" || Array.isArray(document2))
914
- throw new TypeError("Audit requires a design document input.");
915
- const issues = [], checkedArtifacts = [], screens = [];
916
- const frameBoundsSeverity = document2.frames?.some((frame) => frame.height === "auto") ? "error" : "warning";
917
- const expected = new Map(entries.map((entry) => [entry.artifactId, entry]));
918
- const add = (artifactId, rule, severity, message) => issues.push({ artifactId, rule, severity, message });
919
- if (!entries.length || expected.size !== entries.length)
920
- add(
921
- "studio",
922
- "invalid-audit-scope",
923
- "error",
924
- "Audit scope must contain every expected artifact exactly once."
925
- );
926
- if (!page || typeof page.frames !== "function") {
927
- return {
928
- schemaVersion: "1.0.0",
929
- revision,
930
- status: "unverified",
931
- checkedArtifacts,
932
- issues: [
933
- {
934
- artifactId: "studio",
935
- rule: "browser-unavailable",
936
- severity: "warning",
937
- message: "A browser page is required for rendered verification."
938
- }
939
- ],
940
- screenshots: screenshotPaths,
941
- scenarios,
942
- screens
943
- };
944
- }
945
- const loaded = /* @__PURE__ */ new Set();
946
- for (const entry of expected.values()) {
947
- let frameHold;
948
- try {
949
- try {
950
- frameHold = await page.evaluateHandle?.((id) => {
951
- const stage = window.__openPlanrArtifactStage;
952
- return stage?.frameBudget ? stage.holdFrames([id]) : null;
953
- }, entry.artifactId);
954
- await page.evaluate?.(async (id) => {
955
- const stage = window.__openPlanrArtifactStage;
956
- if (stage?.frameBudget) await stage.ensureFrames([id]);
957
- }, entry.artifactId);
958
- } catch (error) {
959
- add(
960
- entry.artifactId,
961
- "frame-load-error",
962
- "error",
963
- `The rendered frame could not be mounted: ${error.message}`
964
- );
965
- continue;
966
- }
967
- let frames;
968
- if (["waitForSelector", "on", "off"].every((method) => typeof page[method] === "function")) {
969
- try {
970
- const frame = await attachedArtifactFrame(
971
- page,
972
- entry.artifactId,
973
- (error) => add(
974
- entry.artifactId,
975
- "frame-attachment-inspection-error",
976
- "warning",
977
- `A frame attachment could not be matched to artifact ${entry.artifactId}: ${error.message}`
978
- )
979
- );
980
- frames = [frame, ...page.frames().filter((candidate) => candidate !== frame)];
981
- } catch (error) {
982
- add(
983
- entry.artifactId,
984
- "frame-load-error",
985
- "error",
986
- `Artifact ${entry.artifactId} has no frame attached for inspection: ${error.message}`
987
- );
988
- continue;
989
- }
990
- } else frames = page.frames();
991
- for (const frame of frames) {
992
- let handle, artifactId, panelState;
993
- try {
994
- if (frame === page.mainFrame?.()) continue;
995
- handle = await frame.frameElement();
996
- artifactId = await handle.getAttribute("data-planr-artifact-frame") ?? await handle.getAttribute("data-planr-artifact-id");
997
- if (artifactId !== entry.artifactId) continue;
998
- if (loaded.has(artifactId)) {
999
- add(
1000
- artifactId,
1001
- "duplicate-frame",
1002
- "error",
1003
- "Multiple frames claim the same artifact identity."
1004
- );
1005
- continue;
1006
- }
1007
- loaded.add(artifactId);
1008
- await frame.waitForLoadState?.("load", { timeout: 5e3 });
1009
- panelState = await handle.evaluate((element) => {
1010
- const panel = element.closest("[data-artifact-id]");
1011
- if (!panel) return null;
1012
- const hidden = panel.hidden;
1013
- panel.hidden = false;
1014
- return { hidden };
1015
- });
1016
- await page.keyboard?.press("Tab");
1017
- const result = await frame.evaluate(auditRenderedScreen, {
1018
- height: entry.height,
1019
- frameBoundsSeverity
1020
- });
1021
- if (result.screenId !== entry.screenId) {
1022
- add(
1023
- artifactId,
1024
- "screen-identity-mismatch",
1025
- "error",
1026
- `Expected screen ${entry.screenId}; loaded ${result.screenId ?? "none"}.`
1027
- );
1028
- continue;
1029
- }
1030
- checkedArtifacts.push(artifactId);
1031
- screens.push({ artifactId, ...result });
1032
- for (const issue of result.issues)
1033
- add(artifactId, issue.rule, issue.severity, issue.message);
1034
- } catch (error) {
1035
- if (artifactId && expected.has(artifactId))
1036
- add(
1037
- artifactId,
1038
- "frame-load-error",
1039
- "error",
1040
- `The rendered frame could not be inspected: ${error.message}`
1041
- );
1042
- } finally {
1043
- if (panelState && handle) {
1044
- await handle.evaluate((element, state) => {
1045
- const panel = element.closest("[data-artifact-id]");
1046
- if (panel) panel.hidden = state.hidden;
1047
- }, panelState).catch(
1048
- (error) => add(
1049
- artifactId,
1050
- "panel-visibility-restore-error",
1051
- "warning",
1052
- `Artifact ${artifactId} panel visibility could not be restored: ${error.message}`
1053
- )
1054
- );
1055
- }
1056
- await handle?.dispose?.();
1057
- }
1058
- }
1059
- } finally {
1060
- try {
1061
- await frameHold?.evaluate((release) => release?.());
1062
- } finally {
1063
- await frameHold?.dispose();
1064
- }
1065
- }
1066
- }
1067
- for (const artifactId of expected.keys()) {
1068
- if (!checkedArtifacts.includes(artifactId))
1069
- add(
1070
- artifactId,
1071
- "missing-frame-inspection",
1072
- "error",
1073
- "The expected artifact has no completed rendered inspection."
1074
- );
1075
- }
1076
- for (const error of await page.pageErrors?.() ?? [])
1077
- add("studio", "browser-script-error", "error", error.message ?? String(error));
1078
- const evidenceComplete = screenshotPaths.length > 0 && scenarios.length > 0 && scenarios.every(({ status: status2 }) => status2 === "passed");
1079
- const status = issues.some(({ severity }) => severity === "error") ? "failed" : evidenceComplete ? "verified" : "unverified";
1080
- return {
1081
- schemaVersion: "1.0.0",
1082
- revision,
1083
- status,
1084
- checkedArtifacts,
1085
- issues,
1086
- screenshots: screenshotPaths,
1087
- scenarios,
1088
- screens
1089
- };
1090
- }
1091
-
1092
- // packages/design/lib/design/utility.mjs
1093
- function isPng(bytes) {
1094
- if (bytes.length < 57 || !bytes.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10])))
1095
- return false;
1096
- let offset = 8, header = false, pixels = false;
1097
- while (offset + 12 <= bytes.length) {
1098
- const length = bytes.readUInt32BE(offset), type = bytes.toString("ascii", offset + 4, offset + 8);
1099
- if (length > bytes.length - offset - 12) return false;
1100
- if (!header) {
1101
- if (type !== "IHDR" || length !== 13 || bytes.readUInt32BE(offset + 8) === 0 || bytes.readUInt32BE(offset + 12) === 0)
1102
- return false;
1103
- header = true;
1104
- } else if (type === "IHDR") return false;
1105
- if (type === "IDAT" && length > 0) pixels = true;
1106
- offset += length + 12;
1107
- if (type === "IEND") return length === 0 && pixels && offset === bytes.length;
1108
- }
1109
- return false;
1110
- }
1111
- function verifyDesignDocument(file, report) {
1112
- const current = currentDesign(file);
1113
- if (!report || report.revision !== current.revision)
1114
- throw new Error("Browser report belongs to a different render revision.");
1115
- const screenEvidence = Array.isArray(report.screens) ? report.screens : [];
1116
- const checkedArtifacts = Array.isArray(report.checkedArtifacts) ? report.checkedArtifacts : [];
1117
- const coverage = current.entries.every((entry) => {
1118
- const frame = current.document.frames.find((item) => item.id === entry.frameId);
1119
- const matches = screenEvidence.filter((item) => item?.artifactId === entry.artifactId);
1120
- return checkedArtifacts.includes(entry.artifactId) && matches.length === 1 && matches[0].screenId === entry.screenId && matchesDesignFrame(frame, matches[0].viewport) && Number.isInteger(matches[0].checkedElements) && matches[0].checkedElements > 0;
1121
- });
1122
- const images = (Array.isArray(report.screenshots) ? report.screenshots : []).filter((item) => {
1123
- const path = typeof item === "string" ? item : item?.path;
1124
- try {
1125
- return typeof path === "string" && isPng(readFileSync(resolve3(path)));
1126
- } catch {
1127
- return false;
1128
- }
1129
- });
1130
- const journeys = Array.isArray(report.scenarios) && report.scenarios.length > 0 && report.scenarios.every(
1131
- (item) => item?.status === "passed" && [item.name, item.id].some((value) => typeof value === "string" && value.trim().length > 0)
1132
- );
1133
- const issues = [
1134
- ...Array.isArray(report.issues) ? report.issues : [],
1135
- ...screenEvidence.flatMap((item) => Array.isArray(item?.issues) ? item.issues : [])
1136
- ];
1137
- const status = issues.some((item) => item?.severity === "error") || report.status === "failed" ? "failed" : coverage && images.length > 0 && journeys && report.status !== "unverified" ? "verified" : "unverified";
1138
- const saved = {
1139
- ...report,
1140
- issues,
1141
- schemaVersion: "1.0.0",
1142
- revision: current.revision,
1143
- status,
1144
- checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
1145
- coverage,
1146
- screenshotCount: images.length,
1147
- primaryJourneysChecked: Boolean(journeys)
1148
- };
1149
- atomicJson(join4(current.root, ".design/verification", `${current.revision}.json`), saved);
1150
- return saved;
1151
- }
1152
- async function designUtility(argv, {
1153
- stdout = (value) => process.stdout.write(`${JSON.stringify(value)}
1154
- `),
1155
- openUrl,
1156
- env = process.env,
1157
- fetchImpl = fetch
1158
- } = {}) {
1159
- if (argv.length === 0 || argv[0] === "--help" || argv[0] === "help") {
1160
- const help = {
1161
- usage: 'design.mjs inspect|validate|render|open|studio|view-context|export|feedback|verify|share|publish|sync|manage|handoff <design-document.json> | design.mjs fonts fetch --family "<Name>:<weights>" [--family ...] --dest <dir>',
1162
- flags: [
1163
- "--json",
1164
- "--no-open",
1165
- "--view canvas|prototype|walkthrough",
1166
- "--port <number>",
1167
- "--format html|json|markdown",
1168
- "--scope current|all",
1169
- "--output <path>",
1170
- "--report <browser-report.json>",
1171
- "--action inspect|export|import|select|resolve|rotate|pause|resume|revoke|delete|recovery|restore|status|stop",
1172
- "--input <private recovery or feedback JSON file>",
1173
- "--revision <current-render-revision>",
1174
- "--request-time <ISO-timestamp>",
1175
- "--allow-stale",
1176
- "--variant <id>",
1177
- "--pins <id,id>",
1178
- "--summary <text>",
1179
- "--family <Name>:<weight,weight> (fonts fetch; at most 2 families, 3 weights each)",
1180
- "--dest <design>/source/assets/fonts (fonts fetch)"
1181
- ],
1182
- note: "The host authors design sources. This utility only validates, renders, reviews and exports them; fonts fetch downloads open-license fonts only when run."
1183
- };
1184
- stdout(help);
1185
- return help;
1186
- }
1187
- const [command, input, ...args] = argv;
1188
- if (![
1189
- "inspect",
1190
- "validate",
1191
- "render",
1192
- "open",
1193
- "studio",
1194
- "view-context",
1195
- "export",
1196
- "feedback",
1197
- "verify",
1198
- "share",
1199
- "publish",
1200
- "sync",
1201
- "manage",
1202
- "handoff",
1203
- "fonts"
1204
- ].includes(command) || !input)
1205
- throw new Error(
1206
- 'Usage: design.mjs inspect|validate|render|open|studio|view-context|export|feedback|verify|share|publish|sync|manage|handoff <design-document.json> [--json] [--no-open] [--view canvas|prototype|walkthrough] | design.mjs fonts fetch --family "<Name>:<weights>" [--family ...] --dest <dir>'
1207
- );
1208
- const flags = {};
1209
- for (let i = 0; i < args.length; i++) {
1210
- if (!args[i].startsWith("--")) throw new Error(`Unexpected argument: ${args[i]}`);
1211
- const key = args[i].slice(2);
1212
- if (![
1213
- "json",
1214
- "no-open",
1215
- "view",
1216
- "format",
1217
- "output",
1218
- "port",
1219
- "report",
1220
- "action",
1221
- "instance-id",
1222
- "pins",
1223
- "summary",
1224
- "variant",
1225
- "input",
1226
- "scope",
1227
- "revision",
1228
- "request-time",
1229
- "allow-stale",
1230
- "family",
1231
- "dest"
1232
- ].includes(key))
1233
- throw new Error(`Unknown option: ${args[i]}`);
1234
- if (["family", "dest"].includes(key) && command !== "fonts")
1235
- throw new Error(`Unknown option for ${command}: ${args[i]}`);
1236
- if (key === "family") flags.family = [...flags.family ?? [], args[++i]];
1237
- else flags[key] = ["json", "no-open", "allow-stale"].includes(key) ? true : args[++i];
1238
- }
1239
- if (flags.view && !["canvas", "prototype", "walkthrough"].includes(flags.view))
1240
- throw new Error("View must be canvas, prototype, or walkthrough.");
1241
- if (command === "fonts") {
1242
- if (input !== "fetch")
1243
- throw new Error(
1244
- 'Usage: design.mjs fonts fetch --family "<Name>:<weights>" [--family ...] --dest <dir>'
1245
- );
1246
- const result2 = await fetchDesignFonts({ families: flags.family, dest: flags.dest, fetchImpl });
1247
- stdout(result2);
1248
- return result2;
1249
- }
1250
- const file = resolve3(input);
1251
- let result;
1252
- if (command === "view-context")
1253
- result = readDesignViewContext(file, { requestTime: flags["request-time"] });
1254
- if (command === "studio")
1255
- result = await manageDesignStudio(file, {
1256
- action: flags.action,
1257
- instanceId: flags["instance-id"],
1258
- env,
1259
- fetchImpl
1260
- });
1261
- if (command === "handoff") {
1262
- const action = flags.action ?? "inspect";
1263
- if (action === "inspect") result = readDesignHandoff(file);
1264
- else {
1265
- const snapshot = readDesignHandoff(file);
1266
- const input2 = flags.input ? readJson(resolve3(flags.input)) : {};
1267
- result = await updateDesignHandoff(file, {
1268
- ...input2,
1269
- action,
1270
- revision: input2.revision ?? snapshot.revision,
1271
- version: input2.version ?? snapshot.draft?.version ?? 0
1272
- });
1273
- }
1274
- }
1275
- if (command === "share") result = await shareDesign(file);
1276
- if (command === "publish") result = await publishDesignShare(file);
1277
- if (command === "sync") result = await syncDesignShare(file);
1278
- if (command === "manage" && !["rotate", "pause", "resume", "revoke", "delete", "recovery", "restore"].includes(flags.action))
1279
- throw new Error("manage requires --action rotate|pause|resume|revoke|delete|recovery|restore.");
1280
- if (command === "manage")
1281
- result = flags.action === "restore" ? await importDesignShareRecovery(file, { input: flags.input }) : flags.action === "recovery" ? await exportDesignShareRecovery(file, { output: flags.output }) : await manageDesignShare(file, flags.action);
1282
- if (command === "inspect") result = inspectDesignDocument(file);
1283
- if (command === "validate") {
1284
- const prepared = prepareDesignDocument(file);
1285
- result = {
1286
- ok: prepared.lint.every((item) => item.ok),
1287
- lint: prepared.lint,
1288
- screens: prepared.document.screens.length,
1289
- artifacts: prepared.entries.length,
1290
- verification: "unverified"
1291
- };
1292
- }
1293
- if (command === "render") result = await renderDesignDocument(file);
1294
- if (command === "open") {
1295
- const port = flags.port === void 0 ? 0 : Number(flags.port);
1296
- if (!Number.isInteger(port) || port < 0 || port > 65535)
1297
- throw new Error("Port must be 0\u201365535.");
1298
- result = await startDesignReview(file, {
1299
- port,
1300
- view: flags.view,
1301
- noOpen: Boolean(flags["no-open"]),
1302
- openUrl,
1303
- env,
1304
- fetchImpl
1305
- });
1306
- const close = result.close;
1307
- if (close) {
1308
- process.once("SIGINT", async () => {
1309
- await close();
1310
- process.exit(0);
1311
- });
1312
- process.once("SIGTERM", async () => {
1313
- await close();
1314
- process.exit(0);
1315
- });
1316
- }
1317
- }
1318
- if (command === "export") {
1319
- const current = currentDesign(file), view = flags.view ?? current.document.defaultView;
1320
- const state = readJson(join4(current.root, ".design/studio-state.json"), { state: {} }).state;
1321
- if (flags.format && flags.format !== "html")
1322
- throw new Error(
1323
- "Portable export supports HTML. Use the studio PNG action for browser-rendered captures."
1324
- );
1325
- const output = resolve3(flags.output ?? join4(current.root, `${view}-export.html`));
1326
- if (existsSync2(output))
1327
- throw new Error(`Export already exists: ${output}. Choose a new --output path.`);
1328
- mkdirSync2(dirname2(output), { recursive: true });
1329
- writeFileSync2(output, standaloneDesignHtml({ ...current, state }, view), { flag: "wx" });
1330
- result = { ok: true, output, view, revision: current.revision };
1331
- }
1332
- if (command === "verify") {
1333
- if (!flags.report) throw new Error("verify requires --report <browser-report.json>.");
1334
- result = verifyDesignDocument(file, readJson(resolve3(flags.report)));
1335
- }
1336
- if (command === "feedback") {
1337
- const action = flags.action ?? "inspect";
1338
- if (action !== "import") await syncDesignShare(file, { env, fetchImpl });
1339
- if (action === "import")
1340
- result = await importDesignFeedback(file, {
1341
- input: flags.input,
1342
- revision: flags.revision,
1343
- allowStale: Boolean(flags["allow-stale"]),
1344
- env
1345
- });
1346
- else if (action === "inspect") result = readDesignFeedback(file, env);
1347
- else if (action === "export") {
1348
- const format = flags.format ?? "json", scope = flags.scope ?? "all";
1349
- if (!["json", "markdown"].includes(format))
1350
- throw new Error("Feedback export format must be json or markdown.");
1351
- if (!["current", "all"].includes(scope))
1352
- throw new Error("Feedback export scope must be current or all.");
1353
- if (!flags.output) throw new Error("Feedback export requires --output <path>.");
1354
- const output = resolve3(flags.output);
1355
- if (existsSync2(output))
1356
- throw new Error("Feedback export already exists. Choose a new --output path.");
1357
- const snapshot = exportDesignReview(file, { scope, env });
1358
- mkdirSync2(dirname2(output), { recursive: true });
1359
- writeFileSync2(output, serializeDesignReviewExport(snapshot, format), {
1360
- flag: "wx",
1361
- mode: 384
1362
- });
1363
- result = {
1364
- ok: true,
1365
- output,
1366
- format,
1367
- scope,
1368
- revision: snapshot.currentRevisionId,
1369
- summary: snapshot.summary
1370
- };
1371
- } else if (action === "resolve")
1372
- result = await resolveDesignPins(file, {
1373
- pinIds: flags.pins?.split(",").filter(Boolean),
1374
- summary: flags.summary,
1375
- env
1376
- });
1377
- else if (action === "select") {
1378
- const current = currentDesign(file), saved = readJson(join4(current.root, ".design/studio-state.json"), {
1379
- state: {},
1380
- stateVersion: 0
1381
- });
1382
- const variant = flags.variant ?? saved.state.selectedVariant;
1383
- if (!current.document.variants.some((item) => item.id === variant && item.status === "ready"))
1384
- throw new Error("Select a ready variant with --variant.");
1385
- const selected = [variant], rejected = (saved.state.preferences?.rejected ?? []).filter((id) => id !== variant);
1386
- result = await saveDesignState(file, {
1387
- ...saved,
1388
- revision: current.revision,
1389
- state: { ...saved.state, selectedVariant: variant, preferences: { selected, rejected } }
1390
- });
1391
- result = {
1392
- ok: true,
1393
- selectedVariant: variant,
1394
- tastePath: result.tastePath,
1395
- revision: current.revision
1396
- };
1397
- } else throw new Error("Feedback action must be inspect, export, import, select, or resolve.");
1398
- }
1399
- stdout(result);
1400
- return result;
1401
- }
1402
- async function main(argv = process.argv.slice(2)) {
1403
- try {
1404
- const result = await designUtility(argv, {
1405
- openUrl: async (url) => {
1406
- const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "explorer.exe" : "xdg-open";
1407
- const child = spawn(command, [url], { stdio: "ignore" });
1408
- child.on("error", () => {
1409
- });
1410
- child.unref();
1411
- }
1412
- });
1413
- if (result?.ok === false || result?.status === "failed") process.exitCode = 1;
1414
- return result;
1415
- } catch (error) {
1416
- process.stderr.write(`${error.message}
1417
- `);
1418
- process.exitCode = 1;
1419
- }
1420
- }
1421
- var invokedDirectly = process.argv[1] && fileURLToPath(import.meta.url) === realpathSync(process.argv[1]);
1422
- if (invokedDirectly) await main();
1423
- export {
1424
- auditDesignPage,
1425
- auditRenderedScreen,
1426
- designUtility,
1427
- main,
1428
- readDesignViewContext,
1429
- verifyDesignDocument
1430
- };