openplanr 3.3.0 → 3.4.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 (267) hide show
  1. package/CHANGELOG.md +52 -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/ship.d.ts.map +1 -1
  10. package/dist/cli/commands/ship.js +2 -0
  11. package/dist/cli/commands/ship.js.map +1 -1
  12. package/dist/dashboard/.vite/manifest.json +2 -2
  13. package/dist/dashboard/assets/index-Cv4Vwhuw.css +2 -0
  14. package/dist/dashboard/assets/index-CvQAlBy3.js +75 -0
  15. package/dist/dashboard/assets/index-CvQAlBy3.js.map +1 -0
  16. package/dist/dashboard/dashboard-manifest.json +14 -14
  17. package/dist/dashboard/index.html +2 -2
  18. package/dist/services/design-artifact-service.d.ts +20 -1
  19. package/dist/services/design-artifact-service.d.ts.map +1 -1
  20. package/dist/services/design-artifact-service.js +137 -18
  21. package/dist/services/design-artifact-service.js.map +1 -1
  22. package/dist/services/ship-checks/contract.d.ts +3 -1
  23. package/dist/services/ship-checks/contract.d.ts.map +1 -1
  24. package/dist/services/ship-checks/contract.js +1 -1
  25. package/dist/services/ship-checks/contract.js.map +1 -1
  26. package/dist/services/ship-checks/discover.d.ts.map +1 -1
  27. package/dist/services/ship-checks/discover.js +2 -1
  28. package/dist/services/ship-checks/discover.js.map +1 -1
  29. package/dist/services/ship-checks/package-contents.d.ts +4 -0
  30. package/dist/services/ship-checks/package-contents.d.ts.map +1 -0
  31. package/dist/services/ship-checks/package-contents.js +91 -0
  32. package/dist/services/ship-checks/package-contents.js.map +1 -0
  33. package/dist/services/ship-checks/packages.d.ts +2 -0
  34. package/dist/services/ship-checks/packages.d.ts.map +1 -1
  35. package/dist/services/ship-checks/packages.js +4 -0
  36. package/dist/services/ship-checks/packages.js.map +1 -1
  37. package/dist/services/ship-checks/scope.js +2 -1
  38. package/dist/services/ship-checks/scope.js.map +1 -1
  39. package/dist/utils/splice-managed-block.js +1 -1
  40. package/dist/utils/splice-managed-block.js.map +1 -1
  41. package/docs/CLI.md +38 -1
  42. package/lib/host-packages/adapter-registry.json +5 -5
  43. package/lib/host-packages/capability-map.json +1 -1
  44. package/lib/host-packages/claude/.claude-plugin/marketplace.json +3 -3
  45. package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +6 -6
  46. package/lib/host-packages/claude/openplanr/.openplanr-content.json +67 -123
  47. package/lib/host-packages/claude/openplanr/README.md +12 -12
  48. package/lib/host-packages/claude/openplanr/references/agents/shared/modes/shared/task-context-resolution.md +4 -4
  49. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-artifact-shell.mjs +2 -4
  50. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-document.mjs +26 -26
  51. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-handoff.mjs +850 -56
  52. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review-state-store.mjs +45 -0
  53. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +65 -74
  54. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -1
  55. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +321 -0
  56. package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs → claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs} +762 -223
  57. package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs → claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs} +537 -5
  58. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +137 -0
  59. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design.mjs +107 -37
  60. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -27
  61. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +138 -133
  62. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +1 -5684
  63. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +2568 -0
  64. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +10 -74
  65. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
  66. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +8 -2
  67. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +5 -1
  68. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +545 -4781
  69. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +219 -452
  70. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +5 -1
  71. package/lib/host-packages/claude/openplanr/skills/delegate/SKILL.md +2 -1
  72. package/lib/host-packages/claude/openplanr/skills/delegate/references/integration-review.md +26 -20
  73. package/lib/host-packages/claude/openplanr/skills/delegate/references/operator-guide.md +25 -1
  74. package/lib/host-packages/claude/openplanr/skills/delegate/references/run-handoff.md +2 -2
  75. package/lib/host-packages/claude/openplanr/skills/delegate/references/worktree-custody.md +17 -9
  76. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
  77. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
  78. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
  79. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/custody.mjs +217 -10
  80. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
  81. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
  82. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
  83. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
  84. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
  85. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
  86. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
  87. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
  88. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
  89. package/lib/host-packages/claude/openplanr/skills/design/references/utilities.md +14 -8
  90. package/lib/host-packages/claude/openplanr/skills/design-loop/references/utilities.md +14 -8
  91. package/lib/host-packages/claude/openplanr/skills/design-review/references/utilities.md +14 -8
  92. package/lib/host-packages/claude/openplanr/skills/investigate/SKILL.md +1 -0
  93. package/lib/host-packages/claude/openplanr/skills/investigate/references/fail-first.md +40 -0
  94. package/lib/host-packages/claude/openplanr/skills/ship/SKILL.md +22 -10
  95. package/lib/host-packages/claude/openplanr/skills/ship/references/fail-first.md +40 -0
  96. package/lib/host-packages/claude/openplanr/skills/ship/references/result-contract.md +7 -3
  97. package/lib/host-packages/cursor/openplanr/.openplanr-content.json +65 -121
  98. package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
  99. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/integration-review.md +26 -20
  100. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/operator-guide.md +25 -1
  101. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/run-handoff.md +2 -2
  102. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/worktree-custody.md +17 -9
  103. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/claude.mjs +15 -3
  104. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/codex.mjs +38 -2
  105. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/native.mjs +5 -0
  106. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/custody.mjs +217 -10
  107. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/handoff.mjs +1080 -0
  108. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integrate.mjs +96 -201
  109. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-files.mjs +3 -382
  110. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/presentation.mjs +29 -12
  111. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-contract.mjs +11 -0
  112. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-execution.mjs +1 -1
  113. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-lifecycle.mjs +14 -10
  114. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-preparation.mjs +4 -0
  115. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-record.mjs +2 -2
  116. package/lib/host-packages/cursor/openplanr/rules/planr-delegate.mdc +2 -1
  117. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/utilities.md +14 -8
  118. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/utilities.md +14 -8
  119. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/utilities.md +14 -8
  120. package/lib/host-packages/cursor/openplanr/rules/planr-investigate/references/fail-first.md +40 -0
  121. package/lib/host-packages/cursor/openplanr/rules/planr-investigate.mdc +1 -0
  122. package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/fail-first.md +40 -0
  123. package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/result-contract.md +7 -3
  124. package/lib/host-packages/cursor/openplanr/rules/planr-ship.mdc +22 -10
  125. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-artifact-shell.mjs +2 -4
  126. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-document.mjs +26 -26
  127. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-handoff.mjs +850 -56
  128. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review-state-store.mjs +45 -0
  129. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +65 -74
  130. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -1
  131. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +321 -0
  132. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/{design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs → design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs} +762 -223
  133. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/{design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs → design-shared-artifact-support-protocol-contracts-9f6918b0.mjs} +537 -5
  134. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +137 -0
  135. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design.mjs +107 -37
  136. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -27
  137. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +138 -133
  138. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +1 -5684
  139. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +2568 -0
  140. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +10 -74
  141. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
  142. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +8 -2
  143. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +5 -1
  144. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +545 -4781
  145. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +219 -452
  146. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +5 -1
  147. package/lib/host-packages/openai/.claude-plugin/marketplace.json +3 -3
  148. package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +2 -2
  149. package/lib/host-packages/openai/openplanr/.openplanr-content.json +68 -124
  150. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-artifact-shell.mjs +2 -4
  151. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-document.mjs +26 -26
  152. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-handoff.mjs +850 -56
  153. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review-state-store.mjs +45 -0
  154. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +65 -74
  155. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -1
  156. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +321 -0
  157. package/lib/host-packages/{claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs → openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs} +762 -223
  158. package/lib/host-packages/{claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs → openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs} +537 -5
  159. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +137 -0
  160. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design.mjs +107 -37
  161. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -27
  162. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +138 -133
  163. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +1 -5684
  164. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +2568 -0
  165. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +10 -74
  166. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
  167. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +8 -2
  168. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +5 -1
  169. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +545 -4781
  170. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +219 -452
  171. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +5 -1
  172. package/lib/host-packages/openai/openplanr/skills/delegate/SKILL.md +2 -1
  173. package/lib/host-packages/openai/openplanr/skills/delegate/openplanr.skill.json +1 -1
  174. package/lib/host-packages/openai/openplanr/skills/delegate/references/integration-review.md +26 -20
  175. package/lib/host-packages/openai/openplanr/skills/delegate/references/operator-guide.md +25 -1
  176. package/lib/host-packages/openai/openplanr/skills/delegate/references/run-handoff.md +2 -2
  177. package/lib/host-packages/openai/openplanr/skills/delegate/references/worktree-custody.md +17 -9
  178. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
  179. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
  180. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
  181. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/custody.mjs +217 -10
  182. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
  183. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
  184. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
  185. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
  186. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
  187. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
  188. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
  189. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
  190. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
  191. package/lib/host-packages/openai/openplanr/skills/design/references/utilities.md +14 -8
  192. package/lib/host-packages/openai/openplanr/skills/design-loop/references/utilities.md +14 -8
  193. package/lib/host-packages/openai/openplanr/skills/design-review/references/utilities.md +14 -8
  194. package/lib/host-packages/openai/openplanr/skills/investigate/SKILL.md +1 -0
  195. package/lib/host-packages/openai/openplanr/skills/investigate/openplanr.skill.json +12 -1
  196. package/lib/host-packages/openai/openplanr/skills/investigate/references/fail-first.md +40 -0
  197. package/lib/host-packages/openai/openplanr/skills/ship/SKILL.md +22 -10
  198. package/lib/host-packages/openai/openplanr/skills/ship/openplanr.skill.json +12 -1
  199. package/lib/host-packages/openai/openplanr/skills/ship/references/fail-first.md +40 -0
  200. package/lib/host-packages/openai/openplanr/skills/ship/references/result-contract.md +7 -3
  201. package/package.json +8 -8
  202. package/dist/dashboard/assets/index-BU5fzjyz.css +0 -1
  203. package/dist/dashboard/assets/index-B_96uzCl.js +0 -572
  204. package/dist/dashboard/assets/index-B_96uzCl.js.map +0 -1
  205. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  206. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  207. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  208. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  209. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  210. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
  211. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  212. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  213. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
  214. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  215. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  216. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  217. 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
  218. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  219. 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
  220. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  221. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  222. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  223. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  224. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  225. package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
  226. package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-transaction.mjs +0 -958
  227. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  228. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  229. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  230. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  231. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  232. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
  233. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  234. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  235. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
  236. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  237. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  238. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  239. 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
  240. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  241. 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
  242. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  243. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  244. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  245. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  246. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  247. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
  248. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
  249. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
  250. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
  251. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
  252. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
  253. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
  254. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
  255. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
  256. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
  257. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
  258. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
  259. 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
  260. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
  261. 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
  262. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
  263. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
  264. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
  265. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
  266. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
  267. package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
@@ -1,22 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- DESIGN_DOCUMENT_SCHEMA,
4
- DESIGN_DOCUMENT_V120_SCHEMA,
5
- DESIGN_REVIEW_BUNDLE_SCHEMA,
6
- LARGE_OBJECT_LIMITS,
3
+ DESIGN_HANDOFF_SCHEMA,
7
4
  assertPlainData,
5
+ assertReviewExperience,
8
6
  canonicalizeJson,
9
7
  validateJson
10
8
  } from "./design-protocol-contracts.mjs";
11
9
 
12
10
  // packages/design/lib/design/plan-handoff-utility.mjs
13
- import { realpathSync as realpathSync5 } from "node:fs";
14
- import { resolve as resolve6 } from "node:path";
11
+ import { realpathSync as realpathSync3 } from "node:fs";
12
+ import { resolve as resolve4 } from "node:path";
15
13
  import { fileURLToPath } from "node:url";
16
14
 
17
15
  // packages/design/lib/design/handoff-reader.mjs
18
- import { existsSync as existsSync5, readFileSync as readFileSync6 } from "node:fs";
19
- import { dirname as dirname6, join as join8 } from "node:path";
16
+ import { existsSync as existsSync4, readFileSync as readFileSync6 } from "node:fs";
17
+ import { dirname as dirname4, join as join7 } from "node:path";
20
18
 
21
19
  // packages/artifact/lib/artifact/envelope.mjs
22
20
  import { createHash } from "node:crypto";
@@ -114,6 +112,24 @@ var PipelineError = class extends Error {
114
112
  }
115
113
  };
116
114
 
115
+ // packages/protocol/src/large-object-limits.mjs
116
+ var LARGE_OBJECT_LIMITS = Object.freeze({
117
+ uniqueHtmlBytes: 100 * 1024 * 1024,
118
+ decodedBytes: 128 * 1024 * 1024,
119
+ catalogBytes: 8 * 1024 * 1024,
120
+ manifestBytes: 64 * 1024,
121
+ chunkBytes: 1024 * 1024,
122
+ chunkPlaintextBytes: 1024 * 1024 - 16,
123
+ chunks: 129,
124
+ ciphertextBytes: 128 * 1024 * 1024 + 129 * 16,
125
+ sources: 256,
126
+ views: 4096,
127
+ resources: 1024,
128
+ eventBytes: 256 * 1024,
129
+ eventPageBytes: 1024 * 1024,
130
+ eventPageCount: 100
131
+ });
132
+
117
133
  // packages/artifact/lib/artifact/artifact-sources.mjs
118
134
  var ARTIFACT_SHARED_ENVELOPE_VERSION = "1.1.0";
119
135
 
@@ -150,9 +166,9 @@ function loadSchema(name, version = void 0) {
150
166
  if (schemaCache.has(key)) return schemaCache.get(key);
151
167
  const path = join(SCHEMAS_ROOT, candidateVersion, `${cleanName}.schema.json`);
152
168
  try {
153
- const schema2 = JSON.parse(readFileSync(path, "utf-8"));
154
- schemaCache.set(key, schema2);
155
- return schema2;
169
+ const schema = JSON.parse(readFileSync(path, "utf-8"));
170
+ schemaCache.set(key, schema);
171
+ return schema;
156
172
  } catch (error) {
157
173
  if (error?.code !== "ENOENT") throw error;
158
174
  }
@@ -270,268 +286,6 @@ function validateArtifactReview(review) {
270
286
  return review;
271
287
  }
272
288
 
273
- // packages/protocol/src/review-experience-contracts.mjs
274
- var text = { type: "string", maxLength: 16384 };
275
- var id = { type: "string", minLength: 1, maxLength: 128 };
276
- var digest = { type: "string", pattern: "^[a-f0-9]{64}$" };
277
- var texts = { type: "array", maxItems: 256, items: text };
278
- var closed = (properties, required = Object.keys(properties)) => ({
279
- type: "object",
280
- additionalProperties: false,
281
- properties,
282
- required
283
- });
284
- var list = (items, maxItems = 256) => ({ type: "array", maxItems, items });
285
- var schema = (name, properties, required) => ({
286
- $schema: "https://json-schema.org/draft/2020-12/schema",
287
- $id: `https://openplanr.dev/schemas/v1.10.0/${name}.schema.json`,
288
- "x-openplanr-contract": { id: name, version: "1.10.0" },
289
- ...closed(properties, required)
290
- });
291
- var DESIGN_REVIEW_CONTEXT_SCHEMA = schema(
292
- "design-review-context",
293
- {
294
- kind: { const: "openplanr-design-review-context" },
295
- schemaVersion: { const: "1.0.0" },
296
- designId: id,
297
- brief: closed({ purpose: text, requests: { ...texts, maxItems: 3 }, audience: text }, [
298
- "purpose",
299
- "requests"
300
- ]),
301
- revisionSummary: text,
302
- implementation: closed({
303
- tokens: list(closed({ name: id, value: text, description: text }, ["name", "value"]), 512),
304
- components: list(
305
- closed(
306
- {
307
- id,
308
- name: text,
309
- screenIds: list(id),
310
- anchorIds: list(id),
311
- states: list(closed({ name: id, description: text })),
312
- notes: text,
313
- responsive: text,
314
- accessibility: text
315
- },
316
- ["id", "name"]
317
- )
318
- ),
319
- responsive: texts,
320
- accessibility: texts
321
- })
322
- },
323
- ["kind", "schemaVersion", "designId", "brief", "implementation"]
324
- );
325
- var DESIGN_FINGERPRINT_SCHEMA = closed({
326
- screenId: id,
327
- variantId: id,
328
- frameId: id,
329
- contentDigest: digest,
330
- guidanceDigest: digest
331
- });
332
- var bundleV11 = {
333
- .../** @type {MutableSchema} */
334
- structuredClone(DESIGN_REVIEW_BUNDLE_SCHEMA),
335
- $id: "https://openplanr.dev/schemas/v1.10.0/design-review-bundle.schema.json",
336
- "x-openplanr-contract": { id: "design-review-bundle", version: "1.10.0" }
337
- };
338
- Object.assign(bundleV11.properties, {
339
- schemaVersion: { const: "1.1.0" },
340
- reviewContext: DESIGN_REVIEW_CONTEXT_SCHEMA,
341
- contextDigest: digest,
342
- fingerprints: list(DESIGN_FINGERPRINT_SCHEMA)
343
- });
344
- bundleV11.required.push("reviewContext", "contextDigest", "fingerprints");
345
- var DESIGN_REVIEW_BUNDLE_V11_SCHEMA = bundleV11;
346
- var bundleV12 = (
347
- /** @type {MutableSchema} */
348
- structuredClone(DESIGN_REVIEW_BUNDLE_V11_SCHEMA)
349
- );
350
- bundleV12.$id = "https://openplanr.dev/schemas/v1.16.0/design-review-bundle.schema.json";
351
- bundleV12["x-openplanr-contract"] = { id: "design-review-bundle", version: "1.16.0" };
352
- Object.assign(bundleV12.properties, {
353
- schemaVersion: { const: "1.2.0" },
354
- envelope: {
355
- type: "object",
356
- required: ["schemaVersion", "sources", "artifacts", "viewer"],
357
- properties: { schemaVersion: { const: "1.1.0" } }
358
- },
359
- entries: {
360
- .../** @type {Record<string, unknown>} */
361
- bundleV12.properties.entries,
362
- maxItems: 4096
363
- },
364
- fingerprints: list(DESIGN_FINGERPRINT_SCHEMA, 4096)
365
- });
366
- var bundleCurrent = (
367
- /** @type {MutableSchema} */
368
- structuredClone(bundleV12)
369
- );
370
- bundleCurrent.$id = "https://openplanr.dev/schemas/v1.20.0/design-review-bundle.schema.json";
371
- bundleCurrent["x-openplanr-contract"] = { id: "design-review-bundle", version: "1.20.0" };
372
- bundleCurrent.properties.schemaVersion = { enum: ["1.1.0", "1.2.0"] };
373
- bundleCurrent.properties.envelope = bundleV11.properties.envelope;
374
- bundleCurrent.allOf = [
375
- {
376
- if: { properties: { schemaVersion: { const: "1.2.0" } } },
377
- then: { properties: { envelope: bundleV12.properties.envelope } }
378
- }
379
- ];
380
- var currentDesign = (
381
- /** @type {MutableSchema} */
382
- bundleCurrent.properties.design
383
- );
384
- for (const key of ["frames", "layout"])
385
- currentDesign.properties[key] = /** @type {Record<string, unknown>} */
386
- DESIGN_DOCUMENT_V120_SCHEMA.properties[key];
387
- bundleCurrent.$defs = structuredClone(DESIGN_DOCUMENT_V120_SCHEMA.$defs);
388
- var currentEntries = (
389
- /** @type {{ items: { properties: Record<string, unknown> } }} */
390
- bundleCurrent.properties.entries
391
- );
392
- currentEntries.items.properties.height = { const: "auto" };
393
- var bundleProps = (
394
- /** @type {MutableSchema} */
395
- structuredClone(bundleCurrent)
396
- );
397
- bundleProps.$id = "https://openplanr.dev/schemas/v1.22.0/design-review-bundle.schema.json";
398
- bundleProps["x-openplanr-contract"] = { id: "design-review-bundle", version: "1.22.0" };
399
- var propsDesign = (
400
- /** @type {MutableSchema} */
401
- bundleProps.properties.design
402
- );
403
- var authoredProperties = (
404
- /** @type {Record<string, unknown>} */
405
- DESIGN_DOCUMENT_SCHEMA.properties
406
- );
407
- propsDesign.properties.schemaVersion = authoredProperties.schemaVersion;
408
- for (const key of ["screens", "variants"]) {
409
- const projected = (
410
- /** @type {{ items: { properties: Record<string, unknown> } }} */
411
- propsDesign.properties[key]
412
- );
413
- const authored = (
414
- /** @type {{ items: { properties: Record<string, unknown> } }} */
415
- authoredProperties[key]
416
- );
417
- projected.items.properties.props = authored.items.properties.props;
418
- }
419
- propsDesign.allOf = structuredClone(DESIGN_DOCUMENT_SCHEMA.allOf);
420
- var item = closed(
421
- {
422
- pinId: id,
423
- reviewId: id,
424
- screenId: id,
425
- revisionId: id,
426
- text,
427
- refinement: text,
428
- stale: { type: "boolean" },
429
- author: text,
430
- reviewOf: digest,
431
- source: text
432
- },
433
- ["pinId", "text"]
434
- );
435
- var DESIGN_HANDOFF_CONTENT_SCHEMA = closed({
436
- summary: text,
437
- agreedChanges: list(item, 1e4),
438
- openQuestions: list(item, 1e4),
439
- deferred: list(item, 1e4),
440
- rejected: list(item, 1e4)
441
- });
442
- var DESIGN_HANDOFF_SCHEMA = schema(
443
- "design-review-handoff",
444
- {
445
- kind: { const: "openplanr-design-review-handoff" },
446
- schemaVersion: { const: "1.0.0" },
447
- title: text,
448
- version: { type: "integer", minimum: 1 },
449
- status: { enum: ["draft", "approved"] },
450
- basis: closed({
451
- designId: id,
452
- sourceRevision: digest,
453
- contextDigest: digest,
454
- reviewOf: digest,
455
- selectedVariant: id,
456
- feedbackDigest: digest,
457
- verificationDigest: digest,
458
- feedbackWatermark: { type: "integer", minimum: 0 }
459
- }),
460
- content: DESIGN_HANDOFF_CONTENT_SCHEMA,
461
- contentHash: digest,
462
- markdown: { type: "string", maxLength: 2097152 },
463
- affectedScreens: list(id),
464
- verificationGaps: texts,
465
- reviewNotes: list(closed({ reviewId: id, text }), 1e4),
466
- approval: closed({ contentHash: digest, at: { type: "string", format: "date-time" } })
467
- },
468
- [
469
- "kind",
470
- "schemaVersion",
471
- "title",
472
- "version",
473
- "status",
474
- "basis",
475
- "content",
476
- "contentHash",
477
- "markdown",
478
- "affectedScreens",
479
- "verificationGaps",
480
- "reviewNotes"
481
- ]
482
- );
483
- var DESIGN_REVIEW_METADATA_PAYLOAD_SCHEMA = {
484
- ...schema(
485
- "design-review-metadata-payload",
486
- {
487
- schemaVersion: { const: "1.0.0" },
488
- kind: { enum: ["category", "disposition"] },
489
- author: { ...text, minLength: 1, maxLength: 160 },
490
- reviewOf: digest,
491
- pinId: id,
492
- category: { enum: ["question", "suggestion", "blocker"] },
493
- disposition: { enum: ["accepted", "deferred", "rejected"] },
494
- reason: text,
495
- updatedAt: { type: "string", format: "date-time" }
496
- },
497
- ["schemaVersion", "kind", "author", "reviewOf", "pinId", "updatedAt"]
498
- ),
499
- allOf: [
500
- {
501
- if: { properties: { kind: { const: "category" } } },
502
- then: { required: ["category"], not: { required: ["disposition"] } }
503
- },
504
- {
505
- if: { properties: { kind: { const: "disposition" } } },
506
- then: { required: ["disposition", "reason"], not: { required: ["category"] } }
507
- }
508
- ]
509
- };
510
- var payloadV11 = {
511
- .../** @type {MutableSchema} */
512
- structuredClone(DESIGN_REVIEW_METADATA_PAYLOAD_SCHEMA),
513
- $id: "https://openplanr.dev/schemas/v1.11.0/design-review-metadata-payload.schema.json",
514
- "x-openplanr-contract": { id: "design-review-metadata-payload", version: "1.11.0" }
515
- };
516
- Object.assign(payloadV11.properties, {
517
- schemaVersion: { const: "1.1.0" },
518
- category: { enum: ["question", "suggestion", "change-request", "blocker"] }
519
- });
520
- function assertReviewExperience(value, contract) {
521
- const errors = validateJson(value, contract);
522
- if (errors.length)
523
- throw new TypeError(
524
- `Invalid ${contract["x-openplanr-contract"]?.id ?? "review data"}: ${errors.slice(0, 4).map((item2) => `${item2.path} ${item2.detail}`).join("; ")}`
525
- );
526
- return value;
527
- }
528
- var REVIEW_EXPERIENCE_SCHEMAS = Object.freeze({
529
- "design-review-context": DESIGN_REVIEW_CONTEXT_SCHEMA,
530
- "design-review-bundle": DESIGN_REVIEW_BUNDLE_V11_SCHEMA,
531
- "design-review-handoff": DESIGN_HANDOFF_SCHEMA,
532
- "design-review-metadata-payload": DESIGN_REVIEW_METADATA_PAYLOAD_SCHEMA
533
- });
534
-
535
289
  // packages/design/lib/design/context.mjs
536
290
  import { createHash as createHash2 } from "node:crypto";
537
291
 
@@ -1678,7 +1432,7 @@ function recoverDesignPublication(root, { ownsRenderLock = false } = {}) {
1678
1432
  function designSpecPath(root) {
1679
1433
  return /(?:^|\/)output\/feats\/feat-[^/]+\/design$/u.test(root.replaceAll("\\", "/")) ? join2(dirname2(root), "design-spec.md") : join2(root, "design-spec.md");
1680
1434
  }
1681
- function currentDesign2(file, { recoverPublication = true } = {}) {
1435
+ function currentDesign(file, { recoverPublication = true } = {}) {
1682
1436
  const root = realpathSync(dirname2(resolve(file)));
1683
1437
  if (recoverPublication) recoverDesignPublication(root);
1684
1438
  else {
@@ -2056,7 +1810,7 @@ function resolveArtifactReviewDestination({
2056
1810
  // packages/design/lib/design/feedback-reader.mjs
2057
1811
  var designReviewKey = (document) => `design-${hash(document.id).slice(0, 24)}`;
2058
1812
  function designReviewPath(file, env = process.env, options = {}) {
2059
- const { root, document } = currentDesign2(file, options);
1813
+ const { root, document } = currentDesign(file, options);
2060
1814
  return resolveArtifactReviewDestination({
2061
1815
  cwd: root,
2062
1816
  env,
@@ -2064,22 +1818,22 @@ function designReviewPath(file, env = process.env, options = {}) {
2064
1818
  }).path;
2065
1819
  }
2066
1820
  function readDesignFeedback(file, env = process.env, options = {}) {
2067
- const current = currentDesign2(file, options);
1821
+ const current = currentDesign(file, options);
2068
1822
  const ledger = readArtifactReviewState(designReviewPath(file, env, options), {
2069
1823
  allowMissing: true
2070
1824
  });
2071
- const digest2 = digestArtifactEnvelope(current.envelope);
1825
+ const digest = digestArtifactEnvelope(current.envelope);
2072
1826
  const pins = (ledger?.reviews ?? []).flatMap(
2073
1827
  (entry) => entry.review.pins.map((pin) => {
2074
- const target = current.entries.find((item2) => item2.artifactId === pin.artifactId);
2075
- const screen = target && current.document.screens.find((item2) => item2.id === target.screenId);
1828
+ const target = current.entries.find((item) => item.artifactId === pin.artifactId);
1829
+ const screen = target && current.document.screens.find((item) => item.id === target.screenId);
2076
1830
  const anchorMissing = pin.anchor?.planrId && screen?.anchors?.length && !screen.anchors.includes(pin.anchor.planrId) && pin.anchor.planrId !== screen.id;
2077
1831
  return {
2078
1832
  ...pin,
2079
1833
  reviewId: entry.review.reviewId,
2080
1834
  reviewOf: entry.review.reviewOf,
2081
1835
  ...entry.review.reviewId.startsWith("shared-") ? { revisionId: entry.review.reviewId.slice(7) } : {},
2082
- stale: entry.stale || entry.review.reviewOf !== digest2 || !target || Boolean(anchorMissing),
1836
+ stale: entry.stale || entry.review.reviewOf !== digest || !target || Boolean(anchorMissing),
2083
1837
  ...target ? { screenId: target.screenId, variantId: target.variantId } : {}
2084
1838
  };
2085
1839
  })
@@ -2098,7 +1852,7 @@ function readDesignFeedback(file, env = process.env, options = {}) {
2098
1852
  }
2099
1853
 
2100
1854
  // packages/design/lib/design/handoff-format.mjs
2101
- var safeMd = (text2) => String(text2).replaceAll("[", "\\[").replaceAll("]", "\\]").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
1855
+ var safeMd = (text) => String(text).replaceAll("[", "\\[").replaceAll("]", "\\]").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2102
1856
  function renderMarkdown(draft, title) {
2103
1857
  const lines = [
2104
1858
  `# ${safeMd(title)} \u2014 review handoff`,
@@ -2115,11 +1869,11 @@ function renderMarkdown(draft, title) {
2115
1869
  ["rejected", "Rejected"]
2116
1870
  ]) {
2117
1871
  lines.push(`## ${label}`, "");
2118
- for (const item2 of draft.content[key]) {
1872
+ for (const item of draft.content[key]) {
2119
1873
  lines.push(
2120
- `- ${safeMd(item2.refinement ?? item2.text)} \u2014 ${safeMd(item2.author ?? "Reviewer")}${item2.stale ? " \xB7 original revision" : ""} [source comment](${item2.source})`
1874
+ `- ${safeMd(item.refinement ?? item.text)} \u2014 ${safeMd(item.author ?? "Reviewer")}${item.stale ? " \xB7 original revision" : ""} [source comment](${item.source})`
2121
1875
  );
2122
- if (item2.refinement) lines.push(` Original comment: ${safeMd(item2.text)}`);
1876
+ if (item.refinement) lines.push(` Original comment: ${safeMd(item.text)}`);
2123
1877
  }
2124
1878
  if (!draft.content[key].length) lines.push("None recorded.");
2125
1879
  lines.push("");
@@ -2353,7 +2107,7 @@ function compileDesignHandoffResolution(input) {
2353
2107
  validatePin(pin);
2354
2108
  counts.set(pin.id, (counts.get(pin.id) ?? 0) + 1);
2355
2109
  }
2356
- const duplicatePinIds = new Set([...counts].filter(([, count]) => count > 1).map(([id2]) => id2));
2110
+ const duplicatePinIds = new Set([...counts].filter(([, count]) => count > 1).map(([id]) => id));
2357
2111
  const known = /* @__PURE__ */ new Set();
2358
2112
  for (const pin of pins) {
2359
2113
  const key = keyOf(pin);
@@ -2471,7 +2225,7 @@ function compileDesignHandoffResolution(input) {
2471
2225
  )
2472
2226
  );
2473
2227
  const severity = new Set(diagnostics.map((value) => value.severity));
2474
- const status = severity.has("stale") ? "stale" : severity.has("blocked") ? "blocked" : items.some((item2) => item2.outcome === "open") ? "attention" : "ready";
2228
+ const status = severity.has("stale") ? "stale" : severity.has("blocked") ? "blocked" : items.some((item) => item.outcome === "open") ? "attention" : "ready";
2475
2229
  return {
2476
2230
  kind: "openplanr-design-handoff-resolution",
2477
2231
  schemaVersion: "1.0.0",
@@ -2479,186 +2233,197 @@ function compileDesignHandoffResolution(input) {
2479
2233
  status,
2480
2234
  complete: source.historyComplete !== false && !["blocked", "stale"].includes(status),
2481
2235
  items,
2482
- implementationScope: items.filter((item2) => item2.implementationScope).map((item2) => item2.id),
2236
+ implementationScope: items.filter((item) => item.implementationScope).map((item) => item.id),
2483
2237
  diagnostics
2484
2238
  };
2485
2239
  }
2486
2240
 
2487
- // packages/design/lib/design/share-status.mjs
2488
- import { existsSync as existsSync4, realpathSync as realpathSync4 } from "node:fs";
2489
- import { homedir as homedir3 } from "node:os";
2490
- import { dirname as dirname5, isAbsolute as isAbsolute3, join as join7, relative as relative3, resolve as resolve5 } from "node:path";
2241
+ // packages/design/lib/design/share-cli-bridge.mjs
2242
+ import { execFile, execFileSync } from "node:child_process";
2243
+ import { existsSync as existsSync3, readFileSync as readFileSync5 } from "node:fs";
2244
+ import { join as join6 } from "node:path";
2491
2245
 
2492
- // packages/artifact/lib/artifact/owner-custody.mjs
2493
- import {
2494
- chmodSync as chmodSync2,
2495
- closeSync as closeSync2,
2496
- existsSync as existsSync3,
2497
- fsyncSync,
2498
- linkSync,
2499
- lstatSync as lstatSync4,
2500
- mkdirSync as mkdirSync4,
2501
- openSync as openSync2,
2502
- readFileSync as readFileSync5,
2503
- realpathSync as realpathSync3,
2504
- renameSync as renameSync4,
2505
- unlinkSync,
2506
- writeFileSync as writeFileSync4
2507
- } from "node:fs";
2508
- import { basename, dirname as dirname4, isAbsolute as isAbsolute2, join as join6, relative as relative2, resolve as resolve4 } from "node:path";
2509
- function custodyError(message2, code = "E_OWNER_CUSTODY_LOCATION") {
2510
- return Object.assign(new Error(message2), { code, status: 400 });
2246
+ // packages/design/lib/design/share-compat.mjs
2247
+ var DESIGN_SHARE_COMPAT = 1;
2248
+
2249
+ // packages/design/lib/design/share-cli-bridge.mjs
2250
+ var CLI = "openplanr";
2251
+ var UPLOAD_TIMEOUT_MS = 30 * 6e4;
2252
+ var STATUS_TIMEOUT_MS = 5e3;
2253
+ var FAILED_HANDSHAKE_TTL_MS = 3e4;
2254
+ var STATUS_TTL_MS = 1e4;
2255
+ var INSTALL = "Install the OpenPlanr CLI with `npm install -g openplanr`, then retry; your local design is unchanged.";
2256
+ var UNAVAILABLE = Object.freeze([
2257
+ "E_DESIGN_SHARE_CLI_REQUIRED",
2258
+ "E_DESIGN_SHARE_CLI_UNRESPONSIVE",
2259
+ "E_DESIGN_SHARE_RUNTIME_MISMATCH",
2260
+ "E_DESIGN_SHARE_PIPELINE_MISSING"
2261
+ ]);
2262
+ function shareError(code, message2, fix) {
2263
+ return Object.assign(new Error(fix ? `${message2} ${fix}` : message2), { code, name: code });
2264
+ }
2265
+ function cliMissing() {
2266
+ return shareError(
2267
+ "E_DESIGN_SHARE_CLI_REQUIRED",
2268
+ "Sharing runs in the OpenPlanr CLI, which is not installed.",
2269
+ INSTALL
2270
+ );
2511
2271
  }
2512
- function pathExists(path) {
2513
- try {
2514
- lstatSync4(path);
2515
- return true;
2516
- } catch (error) {
2517
- if (error.code === "ENOENT") return false;
2518
- throw error;
2272
+ function pathOf(env) {
2273
+ const key = Object.keys(env).find((name) => name.toUpperCase() === "PATH");
2274
+ return key ? env[key] ?? "" : "";
2275
+ }
2276
+ function cliLauncher({
2277
+ platform = process.platform,
2278
+ env = process.env,
2279
+ execPath = process.execPath
2280
+ } = {}) {
2281
+ if (platform !== "win32") return { file: CLI, args: [] };
2282
+ for (const directory of pathOf(env).split(";").filter(Boolean)) {
2283
+ const shim = join6(directory, `${CLI}.cmd`);
2284
+ if (!existsSync3(shim)) continue;
2285
+ const target = /"%~?dp0%?\\([^"\r\n]+?\.js)"/iu.exec(readFileSync5(shim, "utf8"))?.[1];
2286
+ const script = target ? join6(directory, ...target.split("\\")) : join6(directory, "node_modules", CLI, "bin", `${CLI}.js`);
2287
+ if (existsSync3(script)) return { file: execPath, args: [script] };
2519
2288
  }
2289
+ return null;
2520
2290
  }
2521
- function assertDirectoryAncestry(root, label) {
2522
- for (let path = root; dirname4(path) !== path; path = dirname4(path)) {
2523
- if (pathExists(path) && lstatSync4(path).isSymbolicLink())
2524
- throw custodyError(`${label} custody directory must not contain symbolic links.`);
2291
+ function lastJsonLine(stdout) {
2292
+ const line = String(stdout ?? "").trim().split("\n").at(-1);
2293
+ try {
2294
+ return line ? JSON.parse(line) : null;
2295
+ } catch {
2296
+ return null;
2525
2297
  }
2526
2298
  }
2527
- function assertPrivateFile(path, label) {
2528
- const stat = lstatSync4(path);
2529
- if (!stat.isFile() || stat.isSymbolicLink() || process.platform !== "win32" && (stat.mode & 63 || stat.uid !== process.getuid()))
2530
- throw custodyError(
2531
- `${label} owner custody must be a private 0600 file.`,
2532
- "E_OWNER_CUSTODY_INVALID"
2299
+ function settle(command, timeout, error, stdout, stderr) {
2300
+ if (error?.code === "ENOENT") throw cliMissing();
2301
+ if (error?.code === "ETIMEDOUT" || error?.killed || error?.signal)
2302
+ throw shareError(
2303
+ "E_DESIGN_SHARE_CLI_UNRESPONSIVE",
2304
+ `The OpenPlanr CLI did not finish \`artifact ${command}\` within ${Math.round(timeout / 1e3)} s.`,
2305
+ "Check that `openplanr --version` answers, then retry."
2306
+ );
2307
+ const value = lastJsonLine(stdout);
2308
+ if (!error && value && value.ok !== false) return value;
2309
+ if (value && value.ok === false)
2310
+ throw shareError(
2311
+ value.code ?? "E_DESIGN_SHARE_FAILED",
2312
+ value.problem ?? "The OpenPlanr CLI could not complete the sharing operation.",
2313
+ value.recovery
2533
2314
  );
2315
+ const detail = String(stderr ?? "").trim().split("\n").at(-1) || error?.message || "no output";
2316
+ throw shareError(
2317
+ "E_DESIGN_SHARE_FAILED",
2318
+ `openplanr artifact ${command} failed without a JSON result: ${detail}`
2319
+ );
2534
2320
  }
2535
- function assertPrivateDirectory(root, label, recoveryOutput = false) {
2536
- const stat = lstatSync4(root);
2537
- if (!stat.isDirectory() || stat.isSymbolicLink() || !recoveryOutput && process.platform !== "win32" && (stat.mode & 63 || stat.uid !== process.getuid()))
2538
- throw custodyError(`${label} custody must use a private local directory.`);
2321
+ function argv(command, file, flags) {
2322
+ return ["artifact", command, ...flags, "--json", ...file === void 0 ? [] : ["--", file]];
2539
2323
  }
2540
- function readCustody(path, { label = "Owner", format, recoveryInput = false } = {}) {
2541
- if (recoveryInput && existsSync3(path)) {
2542
- assertPrivateFile(path, label);
2543
- path = realpathSync3(path);
2544
- }
2545
- assertDirectoryAncestry(dirname4(path), label);
2546
- if (!pathExists(path)) return null;
2547
- assertPrivateDirectory(dirname4(path), label, recoveryInput);
2548
- assertPrivateFile(path, label);
2549
- let record;
2324
+ function launch(env) {
2325
+ const launcher = cliLauncher({ env });
2326
+ if (!launcher) throw cliMissing();
2327
+ return launcher;
2328
+ }
2329
+ function runSync(command, file, flags, { env = process.env, timeout = STATUS_TIMEOUT_MS } = {}) {
2330
+ const { file: program, args } = launch(env);
2331
+ let stdout;
2550
2332
  try {
2551
- record = JSON.parse(readFileSync5(path, "utf8"));
2552
- } catch {
2553
- throw custodyError(`${label} owner custody is invalid.`, "E_OWNER_CUSTODY_INVALID");
2333
+ stdout = execFileSync(program, [...args, ...argv(command, file, flags)], {
2334
+ env,
2335
+ encoding: "utf8",
2336
+ stdio: ["ignore", "pipe", "pipe"],
2337
+ timeout,
2338
+ windowsHide: true
2339
+ });
2340
+ } catch (error) {
2341
+ return settle(command, timeout, error, error?.stdout, error?.stderr);
2554
2342
  }
2555
- if (record?.kind !== format || record.schemaVersion !== "1.0.0" || !record.custody)
2556
- throw custodyError(`${label} owner custody is invalid.`, "E_OWNER_CUSTODY_INVALID");
2557
- return record;
2343
+ return settle(command, timeout, null, stdout, "");
2558
2344
  }
2559
-
2560
- // packages/artifact/lib/artifact/internal/workspace-address.mjs
2561
- function createWorkspaceAddress({
2562
- label,
2563
- reviewPath,
2564
- defaultBaseUrl = "https://share.openplanr.dev"
2565
- }) {
2566
- function normalizeWorkspaceBase2(baseUrl = defaultBaseUrl) {
2567
- const url = new URL(baseUrl);
2568
- if (url.username || url.password || url.search || url.hash || url.pathname !== "/" || url.protocol !== "https:" && !(url.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname)))
2569
- throw new TypeError(
2570
- `${label} sharing requires an HTTPS origin or a local development server.`
2571
- );
2572
- return url.origin;
2345
+ function compatibility(runtime, error) {
2346
+ if (error) {
2347
+ if (UNAVAILABLE.includes(error.code)) return { error };
2348
+ return {
2349
+ error: shareError(
2350
+ "E_DESIGN_SHARE_RUNTIME_MISMATCH",
2351
+ `The installed OpenPlanr CLI is too old to share designs for this skill (${error.message}).`,
2352
+ "Update the CLI with `npm install -g openplanr`, then retry."
2353
+ )
2354
+ };
2573
2355
  }
2574
- function workspaceReviewUrl2(access) {
2575
- if (!/^[A-Za-z0-9_-]{22,64}$/.test(access.id))
2576
- throw new TypeError(`Invalid ${label.toLowerCase()} workspace identity.`);
2577
- return `${normalizeWorkspaceBase2(access.baseUrl)}${reviewPath}/${access.id}`;
2356
+ if (runtime.designShareCompat === DESIGN_SHARE_COMPAT) return { runtime };
2357
+ const older = typeof runtime.designShareCompat !== "number" || runtime.designShareCompat < DESIGN_SHARE_COMPAT;
2358
+ return {
2359
+ error: shareError(
2360
+ "E_DESIGN_SHARE_RUNTIME_MISMATCH",
2361
+ `The installed OpenPlanr CLI (${runtime.cli}) shares designs in format ${runtime.designShareCompat ?? "unknown"}, but this skill uses format ${DESIGN_SHARE_COMPAT}.`,
2362
+ older ? "Update the CLI with `npm install -g openplanr`, then retry." : "Update the OpenPlanr plugin or skills to match the CLI, then retry."
2363
+ )
2364
+ };
2365
+ }
2366
+ var handshakes = /* @__PURE__ */ new Map();
2367
+ function remembered(env) {
2368
+ const known = handshakes.get(pathOf(env));
2369
+ if (known?.outcome?.error && Date.now() - known.at > FAILED_HANDSHAKE_TTL_MS) {
2370
+ handshakes.delete(pathOf(env));
2371
+ return void 0;
2578
2372
  }
2579
- return { normalizeWorkspaceBase: normalizeWorkspaceBase2, workspaceReviewUrl: workspaceReviewUrl2 };
2373
+ return known;
2580
2374
  }
2581
-
2582
- // packages/design/lib/design/workspace-address.mjs
2583
- var DESIGN_SHARE_BASE_URL = "https://share.openplanr.dev";
2584
- var DESIGN_SHARE_REVIEW_PATH = "/d";
2585
- var address = createWorkspaceAddress({
2586
- label: "Design",
2587
- reviewPath: DESIGN_SHARE_REVIEW_PATH,
2588
- defaultBaseUrl: DESIGN_SHARE_BASE_URL
2589
- });
2590
- var normalizeWorkspaceBase = address.normalizeWorkspaceBase;
2591
- var workspaceReviewUrl = (access) => `${address.workspaceReviewUrl(access)}${access.schemaVersion === "2.0.0" ? "?v=2" : ""}`;
2592
-
2593
- // packages/design/lib/design/share-status.mjs
2594
- var FORMAT = "openplanr-design-owner-custody";
2595
- function custodyLocation(file, options = {}, { allowMissing = false } = {}) {
2596
- const current = currentDesign2(file, options);
2597
- const env = options.env ?? process.env;
2598
- const root = resolve5(options.custodyRoot ?? join7(planrHome(env), "design-shares"));
2599
- let project = current.root;
2600
- for (let candidate = current.root; dirname5(candidate) !== candidate; candidate = dirname5(candidate)) {
2601
- if (existsSync4(join7(candidate, ".git")) || existsSync4(join7(candidate, PLANNING_FOLDER))) {
2602
- project = candidate;
2603
- break;
2604
- }
2375
+ function remember(env, outcome) {
2376
+ handshakes.set(pathOf(env), { at: Date.now(), outcome });
2377
+ return outcome;
2378
+ }
2379
+ function outcomeOf(outcome) {
2380
+ if (outcome.error) throw outcome.error;
2381
+ return outcome.runtime;
2382
+ }
2383
+ function requireCompatibleRuntime(env = process.env) {
2384
+ const known = remembered(env);
2385
+ if (known?.outcome) return outcomeOf(known.outcome);
2386
+ let outcome;
2387
+ try {
2388
+ outcome = compatibility(runSync("share-runtime", void 0, [], { env }));
2389
+ } catch (error) {
2390
+ outcome = compatibility(null, error);
2605
2391
  }
2606
- const key = hash(`${current.root}
2607
- ${current.document.id}`);
2608
- const path = join7(root, `${key}.json`);
2609
- const within = relative3(project, root);
2610
- if ((!allowMissing || existsSync4(path)) && (within === "" || !within.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) && within !== ".." && !isAbsolute3(within)))
2611
- throw new Error(
2612
- "Design owner keys must be stored outside the project. Set PLANR_HOME to a private user-level directory."
2613
- );
2614
- const legacyPath = !options.custodyRoot && !configuredPlanrHome(env) ? join7(realpathSync4(env.HOME || homedir3()), ".openplanr", "design-shares", `${key}.json`) : null;
2615
- return { root, path, current, legacyPath };
2616
- }
2617
- function presentationFingerprint(current, { legacy = false } = {}) {
2618
- const state = readJson(join7(current.root, ".design/studio-state.json"), { state: {} }).state;
2619
- return hash(
2620
- JSON.stringify({
2621
- revision: current.revision,
2622
- selectedVariant: state.selectedVariant ?? current.document.selectedVariant,
2623
- ...legacy ? { positions: state.positions ?? {} } : {},
2624
- verification: current.verification.status
2625
- })
2626
- );
2392
+ return outcomeOf(remember(env, outcome));
2627
2393
  }
2628
- var safeStatus = (record, current) => ({
2629
- ok: true,
2630
- shared: Boolean(record),
2631
- title: current.document.title,
2632
- localRevision: current.revision,
2633
- retention: "until-revoked",
2634
- ...record ? {
2635
- id: record.custody.id,
2636
- url: workspaceReviewUrl(record.custody),
2637
- revision: record.custody.currentRevision ?? record.publishedRevision ?? null,
2638
- publishedRevision: record.publishedRevision ?? null,
2639
- hasUpdate: record.publishedRevision !== current.revision || ![
2640
- presentationFingerprint(current),
2641
- presentationFingerprint(current, { legacy: true })
2642
- ].includes(record.publishedPresentation),
2643
- epoch: record.custody.epoch,
2644
- commentsPaused: Boolean(record.custody.commentsPaused ?? record.commentsPaused),
2645
- revoked: Boolean(record.revoked),
2646
- deleted: Boolean(record.deleted),
2647
- pending: Boolean(
2648
- record.custody.pendingCreate || record.custody.pendingMutation || record.pendingReviewMetadata?.length
2649
- ),
2650
- pendingAction: record.custody.pendingCreate ? "create" : record.custody.pendingMutation?.action ?? (record.pendingReviewMetadata?.length ? "review-metadata" : null),
2651
- pendingReviewMetadata: Boolean(record.pendingReviewMetadata?.length)
2652
- } : {}
2653
- });
2654
- function getDesignShareStatus(file, options = {}) {
2655
- const { path, current, legacyPath } = custodyLocation(file, options);
2656
- const record = readCustody(path, { label: "Design", format: FORMAT }) ?? (legacyPath ? readCustody(legacyPath, { label: "Design", format: FORMAT }) : null);
2657
- return safeStatus(record, current);
2394
+ var statuses = /* @__PURE__ */ new Map();
2395
+ function statusKey(file, env) {
2396
+ try {
2397
+ return `${pathOf(env)}\0${file}\0${currentDesign(file).revision}`;
2398
+ } catch {
2399
+ return null;
2400
+ }
2401
+ }
2402
+ function cachedStatus(key) {
2403
+ const known = key && statuses.get(key);
2404
+ return known && Date.now() - known.at <= STATUS_TTL_MS ? known.value : void 0;
2405
+ }
2406
+ function unavailableStatus(error) {
2407
+ if (!UNAVAILABLE.includes(error.code)) throw error;
2408
+ return { ok: true, shared: false, unavailable: { code: error.code, message: error.message } };
2409
+ }
2410
+ function getDesignShareStatus(file, { env } = {}) {
2411
+ const key = statusKey(file, env);
2412
+ const known = cachedStatus(key);
2413
+ if (known) return known;
2414
+ let value;
2415
+ try {
2416
+ requireCompatibleRuntime(env);
2417
+ value = runSync("status", file, [], { env });
2418
+ } catch (error) {
2419
+ value = unavailableStatus(error);
2420
+ }
2421
+ if (key) statuses.set(key, { at: Date.now(), value });
2422
+ return value;
2658
2423
  }
2659
2424
 
2660
2425
  // packages/design/lib/design/handoff-reader.mjs
2661
- var metadataPath = (current) => join8(current.root, ".design/review-metadata.json");
2426
+ var metadataPath = (current) => join7(current.root, ".design/review-metadata.json");
2662
2427
  var revisionOf2 = (pin) => pin.revisionId ?? pin.reviewId;
2663
2428
  function metadata(current, feedback) {
2664
2429
  const local = readJson(metadataPath(current), { version: 0, byRevision: {} });
@@ -2724,7 +2489,7 @@ function resolutionFor(value, shareStatus) {
2724
2489
  });
2725
2490
  }
2726
2491
  function snapshot(file, env, shareOptions = {}) {
2727
- const current = currentDesign2(file, shareOptions), feedback = readDesignFeedback(file, env, shareOptions), meta = metadata(current, feedback);
2492
+ const current = currentDesign(file, shareOptions), feedback = readDesignFeedback(file, env, shareOptions), meta = metadata(current, feedback);
2728
2493
  const reviewContext = current.reviewContext ?? emptyReviewContext(current.document);
2729
2494
  const basis = {
2730
2495
  designId: current.document.id,
@@ -2763,12 +2528,12 @@ function snapshot(file, env, shareOptions = {}) {
2763
2528
  }
2764
2529
  function readDesignHandoff(file, { env = process.env, ...shareOptions } = {}) {
2765
2530
  const value = snapshot(file, env, shareOptions);
2766
- const path = join8(dirname6(designSpecPath(value.current.root)), "review-handoff.json");
2531
+ const path = join7(dirname4(designSpecPath(value.current.root)), "review-handoff.json");
2767
2532
  const draft = readJson(path, null);
2768
2533
  if (draft) {
2769
2534
  assertDraft(draft);
2770
2535
  const markdownPath = path.replace(/\.json$/u, ".md");
2771
- if (!existsSync5(markdownPath) || readFileSync6(markdownPath, "utf8") !== draft.markdown)
2536
+ if (!existsSync4(markdownPath) || readFileSync6(markdownPath, "utf8") !== draft.markdown)
2772
2537
  throw new Error(
2773
2538
  "The handoff Markdown differs from its approved JSON. Rebuild the handoff projection before using it in Plan."
2774
2539
  );
@@ -2805,9 +2570,9 @@ function assertDraft(draft) {
2805
2570
  }
2806
2571
 
2807
2572
  // packages/design/lib/design/plan-handoff-utility.mjs
2808
- function inspectPlanDesignHandoff(argv, { stdout = (value) => process.stdout.write(`${JSON.stringify(value)}
2573
+ function inspectPlanDesignHandoff(argv2, { stdout = (value) => process.stdout.write(`${JSON.stringify(value)}
2809
2574
  `) } = {}) {
2810
- if (argv.length === 0 || ["--help", "help"].includes(argv[0])) {
2575
+ if (argv2.length === 0 || argv2[0] === "help" || argv2.some((value) => ["--help", "-h"].includes(value))) {
2811
2576
  const help = {
2812
2577
  usage: "design.mjs handoff <design-document.json> [--action inspect] [--json]",
2813
2578
  note: "Reads the existing handoff and its current approval; never renders, publishes, or starts implementation."
@@ -2815,7 +2580,9 @@ function inspectPlanDesignHandoff(argv, { stdout = (value) => process.stdout.wri
2815
2580
  stdout(help);
2816
2581
  return help;
2817
2582
  }
2818
- const [command, input, ...args] = argv;
2583
+ const [command, input, ...args] = argv2;
2584
+ if (typeof input === "string" && input.startsWith("-"))
2585
+ throw new Error(`${input} must be a design document path, not an option.`);
2819
2586
  if (command !== "handoff" || !input)
2820
2587
  throw new Error("Usage: design.mjs handoff <design-document.json> [--action inspect] [--json]");
2821
2588
  for (let index = 0; index < args.length; index += 1) {
@@ -2823,20 +2590,20 @@ function inspectPlanDesignHandoff(argv, { stdout = (value) => process.stdout.wri
2823
2590
  if (args[index] === "--action" && args[++index] === "inspect") continue;
2824
2591
  throw new Error("Plan handoff support only accepts --action inspect and --json.");
2825
2592
  }
2826
- const result = readDesignHandoff(resolve6(input), { recoverPublication: false });
2593
+ const result = readDesignHandoff(resolve4(input), { recoverPublication: false });
2827
2594
  stdout(result);
2828
2595
  return result;
2829
2596
  }
2830
- async function main(argv = process.argv.slice(2)) {
2597
+ async function main(argv2 = process.argv.slice(2)) {
2831
2598
  try {
2832
- return inspectPlanDesignHandoff(argv);
2599
+ return inspectPlanDesignHandoff(argv2);
2833
2600
  } catch (error) {
2834
2601
  process.stderr.write(`${error.code ? `${error.code}: ` : ""}${error.message}
2835
2602
  `);
2836
2603
  process.exitCode = 1;
2837
2604
  }
2838
2605
  }
2839
- if (process.argv[1] && fileURLToPath(import.meta.url) === realpathSync5(process.argv[1]))
2606
+ if (process.argv[1] && fileURLToPath(import.meta.url) === realpathSync3(process.argv[1]))
2840
2607
  await main();
2841
2608
  export {
2842
2609
  inspectPlanDesignHandoff,