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.
- package/CHANGELOG.md +80 -0
- package/dist/cli/commands/artifact-design-share.d.ts +9 -0
- package/dist/cli/commands/artifact-design-share.d.ts.map +1 -0
- package/dist/cli/commands/artifact-design-share.js +200 -0
- package/dist/cli/commands/artifact-design-share.js.map +1 -0
- package/dist/cli/commands/artifact.d.ts.map +1 -1
- package/dist/cli/commands/artifact.js +5 -18
- package/dist/cli/commands/artifact.js.map +1 -1
- package/dist/cli/commands/design.d.ts +3 -0
- package/dist/cli/commands/design.d.ts.map +1 -0
- package/dist/cli/commands/design.js +137 -0
- package/dist/cli/commands/design.js.map +1 -0
- package/dist/cli/commands/groups/operations.d.ts.map +1 -1
- package/dist/cli/commands/groups/operations.js +2 -0
- package/dist/cli/commands/groups/operations.js.map +1 -1
- package/dist/cli/commands/ship.d.ts.map +1 -1
- package/dist/cli/commands/ship.js +2 -0
- package/dist/cli/commands/ship.js.map +1 -1
- package/dist/dashboard/.vite/manifest.json +2 -2
- package/dist/dashboard/assets/index-B-l_941W.js +75 -0
- package/dist/dashboard/assets/index-B-l_941W.js.map +1 -0
- package/dist/dashboard/assets/index-Cv4Vwhuw.css +2 -0
- package/dist/dashboard/dashboard-manifest.json +14 -14
- package/dist/dashboard/index.html +2 -2
- package/dist/services/design-artifact-service.d.ts +42 -1
- package/dist/services/design-artifact-service.d.ts.map +1 -1
- package/dist/services/design-artifact-service.js +198 -19
- package/dist/services/design-artifact-service.js.map +1 -1
- package/dist/services/runtime-manager/runtime-package.js +1 -1
- package/dist/services/runtime-manager/runtime-package.js.map +1 -1
- package/dist/services/ship-checks/contract.d.ts +3 -1
- package/dist/services/ship-checks/contract.d.ts.map +1 -1
- package/dist/services/ship-checks/contract.js +1 -1
- package/dist/services/ship-checks/contract.js.map +1 -1
- package/dist/services/ship-checks/discover.d.ts.map +1 -1
- package/dist/services/ship-checks/discover.js +2 -1
- package/dist/services/ship-checks/discover.js.map +1 -1
- package/dist/services/ship-checks/package-contents.d.ts +4 -0
- package/dist/services/ship-checks/package-contents.d.ts.map +1 -0
- package/dist/services/ship-checks/package-contents.js +91 -0
- package/dist/services/ship-checks/package-contents.js.map +1 -0
- package/dist/services/ship-checks/packages.d.ts +2 -0
- package/dist/services/ship-checks/packages.d.ts.map +1 -1
- package/dist/services/ship-checks/packages.js +4 -0
- package/dist/services/ship-checks/packages.js.map +1 -1
- package/dist/services/ship-checks/scope.js +2 -1
- package/dist/services/ship-checks/scope.js.map +1 -1
- package/dist/utils/splice-managed-block.js +1 -1
- package/dist/utils/splice-managed-block.js.map +1 -1
- package/docs/CLI.md +67 -1
- package/lib/host-packages/adapter-registry.json +5 -5
- package/lib/host-packages/capability-map.json +1 -1
- package/lib/host-packages/claude/.claude-plugin/marketplace.json +3 -3
- package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +6 -6
- package/lib/host-packages/claude/openplanr/.openplanr-content.json +57 -429
- package/lib/host-packages/claude/openplanr/README.md +16 -16
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/shared/task-context-resolution.md +4 -4
- package/lib/host-packages/claude/openplanr/skills/artifact/references/design-sharing.md +2 -2
- package/lib/host-packages/claude/openplanr/skills/delegate/SKILL.md +2 -1
- package/lib/host-packages/claude/openplanr/skills/delegate/references/integration-review.md +26 -20
- package/lib/host-packages/claude/openplanr/skills/delegate/references/operator-guide.md +25 -1
- package/lib/host-packages/claude/openplanr/skills/delegate/references/run-handoff.md +2 -2
- package/lib/host-packages/claude/openplanr/skills/delegate/references/worktree-custody.md +17 -9
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/custody.mjs +217 -10
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
- package/lib/host-packages/claude/openplanr/skills/design/SKILL.md +23 -12
- package/lib/host-packages/claude/openplanr/skills/design/references/design-system.md +2 -2
- package/lib/host-packages/claude/openplanr/skills/design/references/generation.md +3 -3
- package/lib/host-packages/claude/openplanr/skills/design/references/hosted-canvas.md +6 -3
- package/lib/host-packages/claude/openplanr/skills/design/references/review.md +6 -6
- package/lib/host-packages/claude/openplanr/skills/design/references/team-review.md +3 -4
- package/lib/host-packages/claude/openplanr/skills/design/references/utilities.md +78 -32
- package/lib/host-packages/claude/openplanr/skills/design-loop/SKILL.md +15 -7
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/design-system.md +2 -2
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/generation.md +3 -3
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/review.md +6 -6
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/team-review.md +3 -4
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/utilities.md +78 -32
- package/lib/host-packages/claude/openplanr/skills/design-review/SKILL.md +25 -5
- package/lib/host-packages/claude/openplanr/skills/design-review/references/design-system.md +2 -2
- package/lib/host-packages/claude/openplanr/skills/design-review/references/generation.md +3 -3
- package/lib/host-packages/claude/openplanr/skills/design-review/references/review.md +6 -6
- package/lib/host-packages/claude/openplanr/skills/design-review/references/team-review.md +3 -4
- package/lib/host-packages/claude/openplanr/skills/design-review/references/utilities.md +78 -32
- package/lib/host-packages/claude/openplanr/skills/investigate/SKILL.md +1 -0
- package/lib/host-packages/claude/openplanr/skills/investigate/references/fail-first.md +40 -0
- package/lib/host-packages/claude/openplanr/skills/plan/SKILL.md +7 -3
- package/lib/host-packages/claude/openplanr/skills/ship/SKILL.md +22 -10
- package/lib/host-packages/claude/openplanr/skills/ship/references/fail-first.md +40 -0
- package/lib/host-packages/claude/openplanr/skills/ship/references/result-contract.md +7 -3
- package/lib/host-packages/cursor/openplanr/.openplanr-content.json +55 -427
- package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-artifact/references/design-sharing.md +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/integration-review.md +26 -20
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/operator-guide.md +25 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/run-handoff.md +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/worktree-custody.md +17 -9
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/claude.mjs +15 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/codex.mjs +38 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/native.mjs +5 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/custody.mjs +217 -10
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/handoff.mjs +1080 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integrate.mjs +96 -201
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-files.mjs +3 -382
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/presentation.mjs +29 -12
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-contract.mjs +11 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-execution.mjs +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-lifecycle.mjs +14 -10
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-preparation.mjs +4 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-record.mjs +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate.mdc +2 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/design-system.md +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/generation.md +3 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/hosted-canvas.md +6 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/review.md +6 -6
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/team-review.md +3 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/utilities.md +78 -32
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/design-system.md +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/generation.md +3 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/review.md +6 -6
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/team-review.md +3 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/utilities.md +78 -32
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop.mdc +15 -7
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/design-system.md +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/generation.md +3 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/review.md +6 -6
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/team-review.md +3 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/utilities.md +78 -32
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review.mdc +25 -5
- package/lib/host-packages/cursor/openplanr/rules/planr-design.mdc +23 -12
- package/lib/host-packages/cursor/openplanr/rules/planr-investigate/references/fail-first.md +40 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-investigate.mdc +1 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-plan.mdc +7 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/fail-first.md +40 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/result-contract.md +7 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-ship.mdc +22 -10
- package/lib/host-packages/openai/.claude-plugin/marketplace.json +3 -3
- package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +2 -2
- package/lib/host-packages/openai/openplanr/.openplanr-content.json +62 -434
- package/lib/host-packages/openai/openplanr/skills/artifact/references/design-sharing.md +2 -2
- package/lib/host-packages/openai/openplanr/skills/delegate/SKILL.md +2 -1
- package/lib/host-packages/openai/openplanr/skills/delegate/openplanr.skill.json +1 -1
- package/lib/host-packages/openai/openplanr/skills/delegate/references/integration-review.md +26 -20
- package/lib/host-packages/openai/openplanr/skills/delegate/references/operator-guide.md +25 -1
- package/lib/host-packages/openai/openplanr/skills/delegate/references/run-handoff.md +2 -2
- package/lib/host-packages/openai/openplanr/skills/delegate/references/worktree-custody.md +17 -9
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/claude.mjs +15 -3
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/codex.mjs +38 -2
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/native.mjs +5 -0
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/custody.mjs +217 -10
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/handoff.mjs +1080 -0
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integrate.mjs +96 -201
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-files.mjs +3 -382
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/presentation.mjs +29 -12
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-contract.mjs +11 -0
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-execution.mjs +1 -1
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-lifecycle.mjs +14 -10
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-preparation.mjs +4 -0
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-record.mjs +2 -2
- package/lib/host-packages/openai/openplanr/skills/design/SKILL.md +23 -12
- package/lib/host-packages/openai/openplanr/skills/design/openplanr.skill.json +0 -11
- package/lib/host-packages/openai/openplanr/skills/design/references/design-system.md +2 -2
- package/lib/host-packages/openai/openplanr/skills/design/references/generation.md +3 -3
- package/lib/host-packages/openai/openplanr/skills/design/references/hosted-canvas.md +6 -3
- package/lib/host-packages/openai/openplanr/skills/design/references/review.md +6 -6
- package/lib/host-packages/openai/openplanr/skills/design/references/team-review.md +3 -4
- package/lib/host-packages/openai/openplanr/skills/design/references/utilities.md +78 -32
- package/lib/host-packages/openai/openplanr/skills/design-loop/SKILL.md +15 -7
- package/lib/host-packages/openai/openplanr/skills/design-loop/openplanr.skill.json +0 -11
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/design-system.md +2 -2
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/generation.md +3 -3
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/review.md +6 -6
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/team-review.md +3 -4
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/utilities.md +78 -32
- package/lib/host-packages/openai/openplanr/skills/design-review/SKILL.md +25 -5
- package/lib/host-packages/openai/openplanr/skills/design-review/openplanr.skill.json +0 -11
- package/lib/host-packages/openai/openplanr/skills/design-review/references/design-system.md +2 -2
- package/lib/host-packages/openai/openplanr/skills/design-review/references/generation.md +3 -3
- package/lib/host-packages/openai/openplanr/skills/design-review/references/review.md +6 -6
- package/lib/host-packages/openai/openplanr/skills/design-review/references/team-review.md +3 -4
- package/lib/host-packages/openai/openplanr/skills/design-review/references/utilities.md +78 -32
- package/lib/host-packages/openai/openplanr/skills/investigate/SKILL.md +1 -0
- package/lib/host-packages/openai/openplanr/skills/investigate/openplanr.skill.json +12 -1
- package/lib/host-packages/openai/openplanr/skills/investigate/references/fail-first.md +40 -0
- package/lib/host-packages/openai/openplanr/skills/plan/SKILL.md +7 -3
- package/lib/host-packages/openai/openplanr/skills/plan/openplanr.skill.json +0 -11
- package/lib/host-packages/openai/openplanr/skills/ship/SKILL.md +22 -10
- package/lib/host-packages/openai/openplanr/skills/ship/openplanr.skill.json +12 -1
- package/lib/host-packages/openai/openplanr/skills/ship/references/fail-first.md +40 -0
- package/lib/host-packages/openai/openplanr/skills/ship/references/result-contract.md +7 -3
- package/package.json +8 -8
- package/dist/dashboard/assets/index-BU5fzjyz.css +0 -1
- package/dist/dashboard/assets/index-B_96uzCl.js +0 -572
- package/dist/dashboard/assets/index-B_96uzCl.js.map +0 -1
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1774
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-handoff.mjs +0 -1576
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +0 -3385
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -39
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1113
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs +0 -505
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design.mjs +0 -1430
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2050
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
- 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
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -5693
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
- 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
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
- 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
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -124
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -133
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -159
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -5468
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +0 -2844
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -159
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
- package/lib/host-packages/claude/openplanr/skills/design/scripts/design.mjs +0 -12
- package/lib/host-packages/claude/openplanr/skills/design-loop/scripts/design.mjs +0 -12
- package/lib/host-packages/claude/openplanr/skills/design-review/scripts/design.mjs +0 -12
- package/lib/host-packages/claude/openplanr/skills/plan/scripts/design.mjs +0 -12
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-transaction.mjs +0 -958
- package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/design.mjs +0 -12
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/scripts/design.mjs +0 -12
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/scripts/design.mjs +0 -12
- package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/design.mjs +0 -12
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1774
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-handoff.mjs +0 -1576
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +0 -3385
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -39
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1113
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs +0 -505
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design.mjs +0 -1430
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2050
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
- 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
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -5693
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
- 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
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
- 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
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -124
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -133
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -159
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -5468
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +0 -2844
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -159
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1774
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +0 -555
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-compression.mjs +0 -4180
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +0 -647
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-handoff.mjs +0 -1576
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-owner-custody.mjs +0 -129
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-resource-pack.mjs +0 -698
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +0 -3385
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -39
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-support-25485dbf1cb2.mjs +0 -24
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share.mjs +0 -1993
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs +0 -1113
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs +0 -505
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +0 -222
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-b5f28f94.mjs +0 -5907
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design.mjs +0 -1430
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2050
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
- 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
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -5693
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +0 -4175
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +0 -65
- 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
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +0 -62
- 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
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -124
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -133
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -159
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-paste.schema.json +0 -49
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-workspace.schema.json +0 -108
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-create.schema.json +0 -170
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-event.schema.json +0 -97
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-workspace-revision.schema.json +0 -56
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -5468
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +0 -2844
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -159
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/integration-transaction.mjs +0 -958
- package/lib/host-packages/openai/openplanr/skills/design/scripts/design.mjs +0 -12
- package/lib/host-packages/openai/openplanr/skills/design-loop/scripts/design.mjs +0 -12
- package/lib/host-packages/openai/openplanr/skills/design-review/scripts/design.mjs +0 -12
- package/lib/host-packages/openai/openplanr/skills/plan/scripts/design.mjs +0 -12
|
@@ -1,1576 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getDesignShareStatus,
|
|
3
|
-
publishDesignReviewMetadata,
|
|
4
|
-
readArtifactReviewState,
|
|
5
|
-
resolveArtifactReviewDestination,
|
|
6
|
-
withArtifactReviewLock
|
|
7
|
-
} from "./design-share.mjs";
|
|
8
|
-
import {
|
|
9
|
-
DESIGN_HANDOFF_CONTENT_SCHEMA,
|
|
10
|
-
DESIGN_HANDOFF_SCHEMA,
|
|
11
|
-
assertReviewExperience,
|
|
12
|
-
atomicJson,
|
|
13
|
-
currentDesign,
|
|
14
|
-
designSpecPath,
|
|
15
|
-
emptyReviewContext,
|
|
16
|
-
hash,
|
|
17
|
-
readJson,
|
|
18
|
-
reviewDigest
|
|
19
|
-
} from "./design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs";
|
|
20
|
-
import {
|
|
21
|
-
acquireStartLock
|
|
22
|
-
} from "./design-loopback-server.mjs";
|
|
23
|
-
import {
|
|
24
|
-
digestArtifactEnvelope
|
|
25
|
-
} from "./design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs";
|
|
26
|
-
import {
|
|
27
|
-
validateJson
|
|
28
|
-
} from "./design-shared-protocol-contracts-b5f28f94.mjs";
|
|
29
|
-
import {
|
|
30
|
-
assertPlainData,
|
|
31
|
-
canonicalizeJson,
|
|
32
|
-
deepFreeze,
|
|
33
|
-
sha256Hex
|
|
34
|
-
} from "./design-shared-protocol-contracts-75a938cc.mjs";
|
|
35
|
-
|
|
36
|
-
// packages/design/lib/design/feedback-reader.mjs
|
|
37
|
-
import { join } from "node:path";
|
|
38
|
-
var designReviewKey = (document) => `design-${hash(document.id).slice(0, 24)}`;
|
|
39
|
-
function designReviewPath(file, env = process.env, options = {}) {
|
|
40
|
-
const { root, document } = currentDesign(file, options);
|
|
41
|
-
return resolveArtifactReviewDestination({
|
|
42
|
-
cwd: root,
|
|
43
|
-
env,
|
|
44
|
-
artifactId: designReviewKey(document)
|
|
45
|
-
}).path;
|
|
46
|
-
}
|
|
47
|
-
function readDesignFeedback(file, env = process.env, options = {}) {
|
|
48
|
-
const current = currentDesign(file, options);
|
|
49
|
-
const ledger = readArtifactReviewState(designReviewPath(file, env, options), {
|
|
50
|
-
allowMissing: true
|
|
51
|
-
});
|
|
52
|
-
const digest2 = digestArtifactEnvelope(current.envelope);
|
|
53
|
-
const pins = (ledger?.reviews ?? []).flatMap(
|
|
54
|
-
(entry) => entry.review.pins.map((pin) => {
|
|
55
|
-
const target = current.entries.find((item) => item.artifactId === pin.artifactId);
|
|
56
|
-
const screen = target && current.document.screens.find((item) => item.id === target.screenId);
|
|
57
|
-
const anchorMissing = pin.anchor?.planrId && screen?.anchors?.length && !screen.anchors.includes(pin.anchor.planrId) && pin.anchor.planrId !== screen.id;
|
|
58
|
-
return {
|
|
59
|
-
...pin,
|
|
60
|
-
reviewId: entry.review.reviewId,
|
|
61
|
-
reviewOf: entry.review.reviewOf,
|
|
62
|
-
...entry.review.reviewId.startsWith("shared-") ? { revisionId: entry.review.reviewId.slice(7) } : {},
|
|
63
|
-
stale: entry.stale || entry.review.reviewOf !== digest2 || !target || Boolean(anchorMissing),
|
|
64
|
-
...target ? { screenId: target.screenId, variantId: target.variantId } : {}
|
|
65
|
-
};
|
|
66
|
-
})
|
|
67
|
-
);
|
|
68
|
-
return {
|
|
69
|
-
revision: current.revision,
|
|
70
|
-
reviewPath: designReviewPath(file, env, options),
|
|
71
|
-
pins,
|
|
72
|
-
state: readJson(join(current.root, ".design/studio-state.json"), {
|
|
73
|
-
state: {},
|
|
74
|
-
stateVersion: 0
|
|
75
|
-
}).state,
|
|
76
|
-
ledger,
|
|
77
|
-
shared: readJson(join(current.root, ".design/shared-feedback.json"), null)
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// packages/design/lib/design/handoff-reader.mjs
|
|
82
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
83
|
-
import { dirname, join as join2 } from "node:path";
|
|
84
|
-
|
|
85
|
-
// packages/design/lib/design/handoff-format.mjs
|
|
86
|
-
var safeMd = (text2) => String(text2).replaceAll("[", "\\[").replaceAll("]", "\\]").replaceAll("<", "<").replaceAll(">", ">");
|
|
87
|
-
function renderMarkdown(draft, title2) {
|
|
88
|
-
const lines = [
|
|
89
|
-
`# ${safeMd(title2)} \u2014 review handoff`,
|
|
90
|
-
"",
|
|
91
|
-
`Status: ${draft.status}. Source revision: ${draft.basis.sourceRevision}.`,
|
|
92
|
-
"",
|
|
93
|
-
draft.content.summary || "Owner summary has not been written.",
|
|
94
|
-
""
|
|
95
|
-
];
|
|
96
|
-
for (const [key, label] of [
|
|
97
|
-
["agreedChanges", "Agreed changes"],
|
|
98
|
-
["openQuestions", "Open questions"],
|
|
99
|
-
["deferred", "Deferred"],
|
|
100
|
-
["rejected", "Rejected"]
|
|
101
|
-
]) {
|
|
102
|
-
lines.push(`## ${label}`, "");
|
|
103
|
-
for (const item of draft.content[key]) {
|
|
104
|
-
lines.push(
|
|
105
|
-
`- ${safeMd(item.refinement ?? item.text)} \u2014 ${safeMd(item.author ?? "Reviewer")}${item.stale ? " \xB7 original revision" : ""} [source comment](${item.source})`
|
|
106
|
-
);
|
|
107
|
-
if (item.refinement) lines.push(` Original comment: ${safeMd(item.text)}`);
|
|
108
|
-
}
|
|
109
|
-
if (!draft.content[key].length) lines.push("None recorded.");
|
|
110
|
-
lines.push("");
|
|
111
|
-
}
|
|
112
|
-
lines.push(
|
|
113
|
-
"## Overall review notes",
|
|
114
|
-
"",
|
|
115
|
-
...draft.reviewNotes.map((note) => `- ${safeMd(note.text)} (${safeMd(note.reviewId)})`),
|
|
116
|
-
""
|
|
117
|
-
);
|
|
118
|
-
lines.push(
|
|
119
|
-
"## Verification gaps",
|
|
120
|
-
"",
|
|
121
|
-
...draft.verificationGaps.length ? draft.verificationGaps.map((value) => `- ${safeMd(value)}`) : ["None recorded."],
|
|
122
|
-
"",
|
|
123
|
-
"Plan and Ship remain separate user invocations.",
|
|
124
|
-
""
|
|
125
|
-
);
|
|
126
|
-
return lines.join("\n");
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// packages/protocol/src/design-handoff-contracts.mjs
|
|
130
|
-
var DESIGN_HANDOFF_PROTOCOL_VERSION = "1.11.0";
|
|
131
|
-
var DESIGN_HANDOFF_CONTRACT_VERSION = "1.0.0";
|
|
132
|
-
var DESIGN_HANDOFF_AUTHORITY = "prepare-plan";
|
|
133
|
-
var DESIGN_HANDOFF_CHECK_IDS = Object.freeze([
|
|
134
|
-
"current-revision",
|
|
135
|
-
"selected-direction",
|
|
136
|
-
"design-specification",
|
|
137
|
-
"rendered-verification",
|
|
138
|
-
"review-freshness",
|
|
139
|
-
"review-dispositions",
|
|
140
|
-
"unresolved-blockers",
|
|
141
|
-
"approved-review-handoff"
|
|
142
|
-
]);
|
|
143
|
-
var DESIGN_HANDOFF_SOURCE_KINDS = Object.freeze([
|
|
144
|
-
"design-revision",
|
|
145
|
-
"selected-direction",
|
|
146
|
-
"design-specification",
|
|
147
|
-
"rendered-verification",
|
|
148
|
-
"review-context",
|
|
149
|
-
"review-feedback",
|
|
150
|
-
"review-metadata",
|
|
151
|
-
"review-handoff",
|
|
152
|
-
"screen",
|
|
153
|
-
"frame",
|
|
154
|
-
"component",
|
|
155
|
-
"state",
|
|
156
|
-
"flow",
|
|
157
|
-
"token",
|
|
158
|
-
"review-decision",
|
|
159
|
-
"element-anchor"
|
|
160
|
-
]);
|
|
161
|
-
var DESIGN_HANDOFF_REQUIREMENT_KINDS = Object.freeze([
|
|
162
|
-
"behavior",
|
|
163
|
-
"visual-state",
|
|
164
|
-
"responsive",
|
|
165
|
-
"accessibility",
|
|
166
|
-
"content-data-assumption",
|
|
167
|
-
"constraint",
|
|
168
|
-
"verification-intent"
|
|
169
|
-
]);
|
|
170
|
-
var DESIGN_HANDOFF_CONTRACT_FILES = Object.freeze({
|
|
171
|
-
"design-handoff-readiness": "design-handoff-readiness.schema.json",
|
|
172
|
-
"design-implementation-handoff": "design-implementation-handoff.schema.json",
|
|
173
|
-
"design-planning-lineage": "design-planning-lineage.schema.json"
|
|
174
|
-
});
|
|
175
|
-
var text = { type: "string", minLength: 1, maxLength: 16384 };
|
|
176
|
-
var title = { ...text, maxLength: 240 };
|
|
177
|
-
var id = {
|
|
178
|
-
type: "string",
|
|
179
|
-
minLength: 1,
|
|
180
|
-
maxLength: 160,
|
|
181
|
-
pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
|
|
182
|
-
};
|
|
183
|
-
var digest = { type: "string", pattern: "^sha256:[a-f0-9]{64}$" };
|
|
184
|
-
var relativePath = { type: "string", minLength: 1, maxLength: 4096 };
|
|
185
|
-
var timestamp = { type: "string", format: "date-time" };
|
|
186
|
-
var list = (items, maxItems = 1e3) => ({ type: "array", items, maxItems });
|
|
187
|
-
var closed = (properties, required = Object.keys(properties)) => ({
|
|
188
|
-
type: "object",
|
|
189
|
-
additionalProperties: false,
|
|
190
|
-
properties,
|
|
191
|
-
required
|
|
192
|
-
});
|
|
193
|
-
var contract = (name, body) => ({
|
|
194
|
-
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
195
|
-
$id: `https://openplanr.dev/schemas/v1.11.0/${name}.schema.json`,
|
|
196
|
-
"x-openplanr-contract": { id: name, version: DESIGN_HANDOFF_PROTOCOL_VERSION },
|
|
197
|
-
...body
|
|
198
|
-
});
|
|
199
|
-
var action = closed({ id, label: title });
|
|
200
|
-
var anchor = {
|
|
201
|
-
oneOf: [
|
|
202
|
-
closed({ section: id }),
|
|
203
|
-
closed({ screenId: id }),
|
|
204
|
-
closed({ screenId: id, elementId: id }),
|
|
205
|
-
closed({ reviewId: id, pinId: id })
|
|
206
|
-
]
|
|
207
|
-
};
|
|
208
|
-
var evidenceReference = closed(
|
|
209
|
-
{
|
|
210
|
-
id,
|
|
211
|
-
kind: { enum: DESIGN_HANDOFF_SOURCE_KINDS },
|
|
212
|
-
path: relativePath,
|
|
213
|
-
revision: digest,
|
|
214
|
-
digest,
|
|
215
|
-
anchor
|
|
216
|
-
},
|
|
217
|
-
["id", "kind", "path"]
|
|
218
|
-
);
|
|
219
|
-
var readinessCheck = closed(
|
|
220
|
-
{
|
|
221
|
-
id: { enum: DESIGN_HANDOFF_CHECK_IDS },
|
|
222
|
-
status: { enum: ["pass", "attention", "blocked", "stale"] },
|
|
223
|
-
message: title,
|
|
224
|
-
evidenceRefs: list(id, 64),
|
|
225
|
-
recoveryAction: action
|
|
226
|
-
},
|
|
227
|
-
["id", "status", "message", "evidenceRefs"]
|
|
228
|
-
);
|
|
229
|
-
var readinessRecord = closed({
|
|
230
|
-
kind: { const: "openplanr-design-handoff-readiness" },
|
|
231
|
-
schemaVersion: { const: DESIGN_HANDOFF_CONTRACT_VERSION },
|
|
232
|
-
scope: { const: "design-originated" },
|
|
233
|
-
authority: { const: "none" },
|
|
234
|
-
designId: id,
|
|
235
|
-
sourceRevision: { anyOf: [digest, { type: "null" }] },
|
|
236
|
-
selectedVariant: { anyOf: [id, { type: "null" }] },
|
|
237
|
-
status: { enum: ["ready", "attention", "blocked", "stale"] },
|
|
238
|
-
continuation: closed({
|
|
239
|
-
action: { const: DESIGN_HANDOFF_AUTHORITY },
|
|
240
|
-
available: { type: "boolean" }
|
|
241
|
-
}),
|
|
242
|
-
checks: list(readinessCheck, DESIGN_HANDOFF_CHECK_IDS.length),
|
|
243
|
-
evidence: list(evidenceReference, 1e4),
|
|
244
|
-
blockers: list({ enum: DESIGN_HANDOFF_CHECK_IDS }, DESIGN_HANDOFF_CHECK_IDS.length),
|
|
245
|
-
nextActions: list(action, DESIGN_HANDOFF_CHECK_IDS.length)
|
|
246
|
-
});
|
|
247
|
-
var readinessAbsence = closed({
|
|
248
|
-
kind: { const: "openplanr-design-handoff-readiness-absence" },
|
|
249
|
-
schemaVersion: { const: DESIGN_HANDOFF_CONTRACT_VERSION },
|
|
250
|
-
status: { const: "absent" },
|
|
251
|
-
reason: { enum: ["not-computed", "not-applicable", "unavailable"] },
|
|
252
|
-
message: title,
|
|
253
|
-
nextAction: action
|
|
254
|
-
});
|
|
255
|
-
var DESIGN_HANDOFF_READINESS_SCHEMA = contract("design-handoff-readiness", {
|
|
256
|
-
oneOf: [readinessRecord, readinessAbsence]
|
|
257
|
-
});
|
|
258
|
-
var requirement = closed({
|
|
259
|
-
id: { type: "string", pattern: "^REQ-[0-9]{3,}$" },
|
|
260
|
-
kind: { enum: DESIGN_HANDOFF_REQUIREMENT_KINDS },
|
|
261
|
-
statement: text,
|
|
262
|
-
sourceRefs: { ...list(id, 256), minItems: 1 },
|
|
263
|
-
verification: { ...list(text, 256), minItems: 1 }
|
|
264
|
-
});
|
|
265
|
-
var implementationHandoff = closed(
|
|
266
|
-
{
|
|
267
|
-
kind: { const: "openplanr-design-implementation-handoff" },
|
|
268
|
-
schemaVersion: { const: DESIGN_HANDOFF_CONTRACT_VERSION },
|
|
269
|
-
id,
|
|
270
|
-
version: { type: "integer", minimum: 1 },
|
|
271
|
-
status: { enum: ["draft", "approved", "superseded", "revoked"] },
|
|
272
|
-
authority: { const: DESIGN_HANDOFF_AUTHORITY },
|
|
273
|
-
title,
|
|
274
|
-
basis: closed({
|
|
275
|
-
designId: id,
|
|
276
|
-
sourceRevision: digest,
|
|
277
|
-
selectedVariant: id,
|
|
278
|
-
readiness: closed({ status: { enum: ["ready", "attention", "blocked", "stale"] }, digest }),
|
|
279
|
-
reviewHandoff: closed({ version: { type: "integer", minimum: 1 }, contentDigest: digest })
|
|
280
|
-
}),
|
|
281
|
-
sources: list(evidenceReference, 1e4),
|
|
282
|
-
requirements: { ...list(requirement, 1e4), minItems: 1 },
|
|
283
|
-
contentDigest: digest,
|
|
284
|
-
markdown: { type: "string", maxLength: 2097152 },
|
|
285
|
-
approval: closed({
|
|
286
|
-
actorId: id,
|
|
287
|
-
approvedAt: timestamp,
|
|
288
|
-
contentDigest: digest,
|
|
289
|
-
authority: { const: DESIGN_HANDOFF_AUTHORITY }
|
|
290
|
-
}),
|
|
291
|
-
supersededBy: closed({ id, version: { type: "integer", minimum: 1 }, contentDigest: digest }),
|
|
292
|
-
revocation: closed({ actorId: id, revokedAt: timestamp, reason: text })
|
|
293
|
-
},
|
|
294
|
-
[
|
|
295
|
-
"kind",
|
|
296
|
-
"schemaVersion",
|
|
297
|
-
"id",
|
|
298
|
-
"version",
|
|
299
|
-
"status",
|
|
300
|
-
"authority",
|
|
301
|
-
"title",
|
|
302
|
-
"basis",
|
|
303
|
-
"sources",
|
|
304
|
-
"requirements",
|
|
305
|
-
"contentDigest",
|
|
306
|
-
"markdown"
|
|
307
|
-
]
|
|
308
|
-
);
|
|
309
|
-
implementationHandoff.allOf = [
|
|
310
|
-
{
|
|
311
|
-
if: { properties: { status: { const: "approved" } }, required: ["status"] },
|
|
312
|
-
then: {
|
|
313
|
-
required: ["approval"],
|
|
314
|
-
not: { anyOf: [{ required: ["supersededBy"] }, { required: ["revocation"] }] }
|
|
315
|
-
}
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
if: { properties: { status: { const: "superseded" } }, required: ["status"] },
|
|
319
|
-
then: { required: ["approval", "supersededBy"], not: { required: ["revocation"] } }
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
if: { properties: { status: { const: "revoked" } }, required: ["status"] },
|
|
323
|
-
then: { required: ["approval", "revocation"], not: { required: ["supersededBy"] } }
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
if: { properties: { status: { const: "draft" } }, required: ["status"] },
|
|
327
|
-
then: {
|
|
328
|
-
not: {
|
|
329
|
-
anyOf: [
|
|
330
|
-
{ required: ["approval"] },
|
|
331
|
-
{ required: ["supersededBy"] },
|
|
332
|
-
{ required: ["revocation"] }
|
|
333
|
-
]
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
];
|
|
338
|
-
var DESIGN_IMPLEMENTATION_HANDOFF_SCHEMA = contract(
|
|
339
|
-
"design-implementation-handoff",
|
|
340
|
-
implementationHandoff
|
|
341
|
-
);
|
|
342
|
-
var lineageMapping = closed({
|
|
343
|
-
requirementId: { type: "string", pattern: "^REQ-[0-9]{3,}$" },
|
|
344
|
-
acceptanceRefs: {
|
|
345
|
-
...list(
|
|
346
|
-
closed({
|
|
347
|
-
storyId: { type: "string", pattern: "^US-[0-9]{3,}$" },
|
|
348
|
-
acceptanceId: { type: "string", pattern: "^AC-[0-9]{3,}$" }
|
|
349
|
-
}),
|
|
350
|
-
256
|
|
351
|
-
),
|
|
352
|
-
minItems: 1
|
|
353
|
-
},
|
|
354
|
-
taskIds: { ...list({ type: "string", pattern: "^T-[0-9]{3,}$" }, 256), minItems: 1 }
|
|
355
|
-
});
|
|
356
|
-
var DESIGN_PLANNING_LINEAGE_SCHEMA = contract(
|
|
357
|
-
"design-planning-lineage",
|
|
358
|
-
closed({
|
|
359
|
-
kind: { const: "openplanr-design-planning-lineage" },
|
|
360
|
-
schemaVersion: { const: DESIGN_HANDOFF_CONTRACT_VERSION },
|
|
361
|
-
handoff: closed({ id, version: { type: "integer", minimum: 1 }, contentDigest: digest }),
|
|
362
|
-
specId: { type: "string", pattern: "^SPEC-[0-9]{3,}$" },
|
|
363
|
-
mappings: { ...list(lineageMapping, 1e4), minItems: 1 }
|
|
364
|
-
})
|
|
365
|
-
);
|
|
366
|
-
var DESIGN_HANDOFF_SCHEMAS = deepFreeze({
|
|
367
|
-
"design-handoff-readiness": DESIGN_HANDOFF_READINESS_SCHEMA,
|
|
368
|
-
"design-implementation-handoff": DESIGN_IMPLEMENTATION_HANDOFF_SCHEMA,
|
|
369
|
-
"design-planning-lineage": DESIGN_PLANNING_LINEAGE_SCHEMA
|
|
370
|
-
});
|
|
371
|
-
function distinct(items, select, label) {
|
|
372
|
-
const values = items.map(select);
|
|
373
|
-
if (new Set(values).size !== values.length) throw new TypeError(`Duplicate ${label}.`);
|
|
374
|
-
}
|
|
375
|
-
function isDesignHandoffRelativePath(value) {
|
|
376
|
-
return typeof value === "string" && value.length > 0 && value.length <= 4096 && !/^(?:[A-Za-z]:|\/|[A-Za-z][A-Za-z0-9+.-]*:)|[\\?#%\u0000-\u001f\u007f]/u.test(value) && value.split("/").every(
|
|
377
|
-
(part) => part && part !== "." && part !== ".." && !["__proto__", "prototype", "constructor"].includes(part)
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
function assertDesignHandoffContract(value, schemaOrName) {
|
|
381
|
-
const schema = typeof schemaOrName === "string" ? DESIGN_HANDOFF_SCHEMAS[schemaOrName] : schemaOrName;
|
|
382
|
-
if (!schema) throw new TypeError("Unknown design handoff contract.");
|
|
383
|
-
assertPlainData(value, "Design handoff data");
|
|
384
|
-
canonicalizeJson(value);
|
|
385
|
-
const errors = validateJson(value, schema);
|
|
386
|
-
if (errors.length)
|
|
387
|
-
throw new TypeError(
|
|
388
|
-
`Invalid ${schema["x-openplanr-contract"]?.id ?? "design handoff data"}: ${errors.slice(0, 5).map((error) => `${error.path} (${error.rule})`).join("; ")}`
|
|
389
|
-
);
|
|
390
|
-
return value;
|
|
391
|
-
}
|
|
392
|
-
function assertEvidenceReferences(evidence2) {
|
|
393
|
-
distinct(evidence2, (item) => item.id, "evidence reference identity");
|
|
394
|
-
for (const item of evidence2)
|
|
395
|
-
if (!isDesignHandoffRelativePath(item.path))
|
|
396
|
-
throw new TypeError("Design handoff evidence requires a repository-relative logical path.");
|
|
397
|
-
}
|
|
398
|
-
function assertProductCopy(value) {
|
|
399
|
-
if (/\b(?:hash|digest|checksum|sha[- ]?256|canonical(?:ize|ization)?)\b/iu.test(value))
|
|
400
|
-
throw new TypeError("Design readiness guidance must use product language.");
|
|
401
|
-
}
|
|
402
|
-
function assertDesignHandoffReadiness(value) {
|
|
403
|
-
assertDesignHandoffContract(value, DESIGN_HANDOFF_READINESS_SCHEMA);
|
|
404
|
-
if (value.kind.endsWith("-absence")) {
|
|
405
|
-
assertProductCopy(`${value.message} ${value.nextAction.label}`);
|
|
406
|
-
return value;
|
|
407
|
-
}
|
|
408
|
-
assertEvidenceReferences(value.evidence);
|
|
409
|
-
distinct(value.checks, (item) => item.id, "readiness check identity");
|
|
410
|
-
const expected = DESIGN_HANDOFF_CHECK_IDS.join("\n");
|
|
411
|
-
if (value.checks.map((item) => item.id).join("\n") !== expected)
|
|
412
|
-
throw new TypeError("Design readiness must contain every stable check in canonical order.");
|
|
413
|
-
const evidenceIds = new Set(value.evidence.map((item) => item.id));
|
|
414
|
-
for (const check of value.checks) {
|
|
415
|
-
distinct(check.evidenceRefs, (item) => item, "readiness evidence reference");
|
|
416
|
-
if (check.evidenceRefs.some((reference) => !evidenceIds.has(reference)))
|
|
417
|
-
throw new TypeError("Design readiness references missing evidence.");
|
|
418
|
-
assertProductCopy(`${check.message} ${check.recoveryAction?.label ?? ""}`);
|
|
419
|
-
}
|
|
420
|
-
const priority2 = { pass: 0, attention: 1, blocked: 2, stale: 3 };
|
|
421
|
-
const worst = value.checks.reduce(
|
|
422
|
-
(current, check) => priority2[check.status] > priority2[current] ? check.status : current,
|
|
423
|
-
"pass"
|
|
424
|
-
);
|
|
425
|
-
const expectedStatus = worst === "pass" ? "ready" : worst;
|
|
426
|
-
if (value.status !== expectedStatus)
|
|
427
|
-
throw new TypeError("Design readiness summary does not match its checks.");
|
|
428
|
-
const blockingIds = value.checks.filter((check) => ["blocked", "stale"].includes(check.status)).map((check) => check.id);
|
|
429
|
-
if (value.blockers.join("\n") !== blockingIds.join("\n"))
|
|
430
|
-
throw new TypeError("Design readiness blockers do not match its blocking checks.");
|
|
431
|
-
const actionable = value.checks.filter((check) => check.status !== "pass");
|
|
432
|
-
if (value.nextActions.length !== actionable.length || value.nextActions.some((actionValue, index) => {
|
|
433
|
-
const recoveryAction = actionable[index].recoveryAction;
|
|
434
|
-
return actionValue.id !== recoveryAction?.id || actionValue.label !== recoveryAction?.label;
|
|
435
|
-
}))
|
|
436
|
-
throw new TypeError("Design readiness next actions do not match its checks.");
|
|
437
|
-
if (value.continuation.available !== ["ready", "attention"].includes(value.status))
|
|
438
|
-
throw new TypeError("Design readiness continuation availability does not match its status.");
|
|
439
|
-
return value;
|
|
440
|
-
}
|
|
441
|
-
function designImplementationHandoffDigest(value) {
|
|
442
|
-
const projection = {
|
|
443
|
-
kind: value.kind,
|
|
444
|
-
schemaVersion: value.schemaVersion,
|
|
445
|
-
id: value.id,
|
|
446
|
-
version: value.version,
|
|
447
|
-
authority: value.authority,
|
|
448
|
-
title: value.title,
|
|
449
|
-
basis: value.basis,
|
|
450
|
-
sources: value.sources,
|
|
451
|
-
requirements: value.requirements,
|
|
452
|
-
markdown: value.markdown
|
|
453
|
-
};
|
|
454
|
-
return `sha256:${sha256Hex(canonicalizeJson(projection))}`;
|
|
455
|
-
}
|
|
456
|
-
function assertDesignImplementationHandoff(value) {
|
|
457
|
-
assertDesignHandoffContract(value, DESIGN_IMPLEMENTATION_HANDOFF_SCHEMA);
|
|
458
|
-
assertEvidenceReferences(value.sources);
|
|
459
|
-
distinct(value.requirements, (item) => item.id, "implementation requirement identity");
|
|
460
|
-
const sourceIds = new Set(value.sources.map((item) => item.id));
|
|
461
|
-
for (const item of value.requirements) {
|
|
462
|
-
distinct(item.sourceRefs, (reference) => reference, "requirement source reference");
|
|
463
|
-
if (item.sourceRefs.some((reference) => !sourceIds.has(reference)))
|
|
464
|
-
throw new TypeError("Implementation requirement references missing evidence.");
|
|
465
|
-
}
|
|
466
|
-
if (value.contentDigest !== designImplementationHandoffDigest(value))
|
|
467
|
-
throw new TypeError(
|
|
468
|
-
"Implementation handoff content does not match its recorded integrity value."
|
|
469
|
-
);
|
|
470
|
-
if (value.approval?.contentDigest !== void 0 && value.approval.contentDigest !== value.contentDigest)
|
|
471
|
-
throw new TypeError("Implementation handoff approval does not match its content.");
|
|
472
|
-
if (value.status !== "draft" && value.basis.readiness.status !== "ready")
|
|
473
|
-
throw new TypeError(
|
|
474
|
-
"Only a ready implementation handoff can be approved or retained as approved history."
|
|
475
|
-
);
|
|
476
|
-
if (value.supersededBy && value.supersededBy.id === value.id && value.supersededBy.version <= value.version)
|
|
477
|
-
throw new TypeError("A superseding handoff must identify a newer package version.");
|
|
478
|
-
return value;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
// packages/design/lib/design/handoff-readiness.mjs
|
|
482
|
-
var CHECKS = Object.freeze([
|
|
483
|
-
"current-revision",
|
|
484
|
-
"selected-direction",
|
|
485
|
-
"design-specification",
|
|
486
|
-
"rendered-verification",
|
|
487
|
-
"review-freshness",
|
|
488
|
-
"review-dispositions",
|
|
489
|
-
"unresolved-blockers",
|
|
490
|
-
"approved-review-handoff"
|
|
491
|
-
]);
|
|
492
|
-
var action2 = Object.freeze({
|
|
493
|
-
"current-revision": Object.freeze({ id: "render-design", label: "Render the current design" }),
|
|
494
|
-
"selected-direction": Object.freeze({
|
|
495
|
-
id: "select-direction",
|
|
496
|
-
label: "Choose one ready direction"
|
|
497
|
-
}),
|
|
498
|
-
"design-specification": Object.freeze({
|
|
499
|
-
id: "complete-design-specification",
|
|
500
|
-
label: "Complete the design specification"
|
|
501
|
-
}),
|
|
502
|
-
"rendered-verification": Object.freeze({
|
|
503
|
-
id: "verify-rendered-design",
|
|
504
|
-
label: "Verify the rendered design"
|
|
505
|
-
}),
|
|
506
|
-
"review-freshness": Object.freeze({
|
|
507
|
-
id: "refresh-review",
|
|
508
|
-
label: "Refresh review against the current design"
|
|
509
|
-
}),
|
|
510
|
-
"review-dispositions": Object.freeze({
|
|
511
|
-
id: "resolve-review-decisions",
|
|
512
|
-
label: "Record the remaining review decisions"
|
|
513
|
-
}),
|
|
514
|
-
"unresolved-blockers": Object.freeze({
|
|
515
|
-
id: "resolve-review-blockers",
|
|
516
|
-
label: "Resolve the blocking feedback"
|
|
517
|
-
}),
|
|
518
|
-
"approved-review-handoff": Object.freeze({
|
|
519
|
-
id: "approve-review-handoff",
|
|
520
|
-
label: "Prepare and approve the current review handoff"
|
|
521
|
-
})
|
|
522
|
-
});
|
|
523
|
-
var message = Object.freeze({
|
|
524
|
-
"current-revision": Object.freeze({
|
|
525
|
-
pass: "The current design has a completed render.",
|
|
526
|
-
blocked: "Render the design before preparing work for engineering."
|
|
527
|
-
}),
|
|
528
|
-
"selected-direction": Object.freeze({
|
|
529
|
-
pass: "One ready design direction is selected.",
|
|
530
|
-
blocked: "Choose one ready design direction before continuing.",
|
|
531
|
-
stale: "The selected direction changed after the review handoff was prepared."
|
|
532
|
-
}),
|
|
533
|
-
"design-specification": Object.freeze({
|
|
534
|
-
pass: "The design specification is complete for this revision.",
|
|
535
|
-
blocked: "Complete the design specification before continuing.",
|
|
536
|
-
stale: "The design specification belongs to an earlier revision."
|
|
537
|
-
}),
|
|
538
|
-
"rendered-verification": Object.freeze({
|
|
539
|
-
pass: "The rendered design is verified for this revision.",
|
|
540
|
-
blocked: "Complete rendered design verification before continuing.",
|
|
541
|
-
stale: "Rendered verification belongs to an earlier revision."
|
|
542
|
-
}),
|
|
543
|
-
"review-freshness": Object.freeze({
|
|
544
|
-
pass: "Review feedback is current for this revision.",
|
|
545
|
-
blocked: "Review feedback contains ambiguous identities or anchors.",
|
|
546
|
-
stale: "Review feedback belongs to an earlier revision."
|
|
547
|
-
}),
|
|
548
|
-
"review-dispositions": Object.freeze({
|
|
549
|
-
pass: "Every current review comment has a recorded outcome.",
|
|
550
|
-
attention: "Some non-blocking review comments still need an owner decision.",
|
|
551
|
-
blocked: "Review decisions are incomplete or ambiguous."
|
|
552
|
-
}),
|
|
553
|
-
"unresolved-blockers": Object.freeze({
|
|
554
|
-
pass: "No blocking feedback remains open.",
|
|
555
|
-
blocked: "Blocking feedback must be resolved before continuing.",
|
|
556
|
-
stale: "A prior decision must be reviewed against the current design."
|
|
557
|
-
}),
|
|
558
|
-
"approved-review-handoff": Object.freeze({
|
|
559
|
-
pass: "The current review handoff is approved.",
|
|
560
|
-
blocked: "Prepare and approve the review handoff before continuing.",
|
|
561
|
-
stale: "The approved review handoff no longer matches the current design."
|
|
562
|
-
})
|
|
563
|
-
});
|
|
564
|
-
var priority = Object.freeze({ pass: 0, attention: 1, blocked: 2, stale: 3 });
|
|
565
|
-
var digestPattern = /^(?:sha256:)?[a-f0-9]{64}$/u;
|
|
566
|
-
var normalizeDigest = (value, label) => {
|
|
567
|
-
if (typeof value !== "string" || !digestPattern.test(value))
|
|
568
|
-
throw new TypeError(`${label} must be a lowercase SHA-256 value.`);
|
|
569
|
-
return value.startsWith("sha256:") ? value : `sha256:${value}`;
|
|
570
|
-
};
|
|
571
|
-
var optionalDigest = (value, label) => value === void 0 || value === null ? void 0 : normalizeDigest(value, label);
|
|
572
|
-
var plainClone = (value) => value === void 0 ? void 0 : JSON.parse(canonicalizeJson(value));
|
|
573
|
-
var logicalPath = (value, fallback, label) => {
|
|
574
|
-
const result = value ?? fallback;
|
|
575
|
-
if (!isDesignHandoffRelativePath(result) || /[?#%]/u.test(result))
|
|
576
|
-
throw new TypeError(`${label} must be a repository-relative logical path.`);
|
|
577
|
-
return result;
|
|
578
|
-
};
|
|
579
|
-
var evidenceDigest = (value) => `sha256:${sha256Hex(canonicalizeJson(value))}`;
|
|
580
|
-
function ensureUnique(items, select, label) {
|
|
581
|
-
const values = items.map(select);
|
|
582
|
-
if (new Set(values).size !== values.length) throw new TypeError(`Duplicate ${label}.`);
|
|
583
|
-
}
|
|
584
|
-
function evidence(id2, kind, path, value, { revision, anchor: anchor2 } = {}) {
|
|
585
|
-
return {
|
|
586
|
-
id: id2,
|
|
587
|
-
kind,
|
|
588
|
-
path,
|
|
589
|
-
...revision ? { revision: normalizeDigest(revision, `${id2} revision`) } : {},
|
|
590
|
-
digest: optionalDigest(value?.digest, `${id2} integrity`) ?? evidenceDigest(value),
|
|
591
|
-
...anchor2 ? { anchor: anchor2 } : {}
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
function checked(id2, status, evidenceRefs = []) {
|
|
595
|
-
return {
|
|
596
|
-
id: id2,
|
|
597
|
-
status,
|
|
598
|
-
message: message[id2][status],
|
|
599
|
-
evidenceRefs,
|
|
600
|
-
...status === "pass" ? {} : { recoveryAction: action2[id2] }
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
function selectedDirection(document, studioState) {
|
|
604
|
-
const selected = studioState?.selectedVariant ?? document?.selectedVariant ?? null;
|
|
605
|
-
const variants = Array.isArray(document?.variants) ? document.variants : [];
|
|
606
|
-
ensureUnique(variants, (item) => item?.id, "design direction identity");
|
|
607
|
-
const matches = variants.filter((item) => item?.id === selected && item?.status === "ready");
|
|
608
|
-
return { selected, ready: matches.length === 1 };
|
|
609
|
-
}
|
|
610
|
-
function normalizedPins(review, revision) {
|
|
611
|
-
const pins = Array.isArray(review?.pins) ? review.pins.map((pin) => ({ ...pin })) : [];
|
|
612
|
-
ensureUnique(
|
|
613
|
-
pins,
|
|
614
|
-
(pin) => `${pin.revisionId ?? pin.reviewId ?? ""}:${pin.id ?? ""}`,
|
|
615
|
-
"review comment identity"
|
|
616
|
-
);
|
|
617
|
-
for (const pin of pins) {
|
|
618
|
-
if (typeof pin.id !== "string" || !pin.id)
|
|
619
|
-
throw new TypeError("Review comments require stable identities.");
|
|
620
|
-
if (pin.elementId && !pin.screenId)
|
|
621
|
-
throw new TypeError("An element review anchor must identify its screen.");
|
|
622
|
-
if (pin.anchorCount !== void 0 && pin.anchorCount !== 1)
|
|
623
|
-
throw new TypeError("Review comments must identify exactly one anchor.");
|
|
624
|
-
}
|
|
625
|
-
return pins.sort(
|
|
626
|
-
(left, right) => `${left.revisionId ?? left.reviewId}:${left.id}`.localeCompare(
|
|
627
|
-
`${right.revisionId ?? right.reviewId}:${right.id}`
|
|
628
|
-
)
|
|
629
|
-
).map((pin) => ({
|
|
630
|
-
...pin,
|
|
631
|
-
current: !pin.stale && (!revision || !pin.revisionId || normalizeDigest(pin.revisionId, "review revision") === revision)
|
|
632
|
-
}));
|
|
633
|
-
}
|
|
634
|
-
function reviewState(input, revision) {
|
|
635
|
-
if (!input) return { pins: [], stale: false, ambiguous: false };
|
|
636
|
-
const pins = normalizedPins(input, revision);
|
|
637
|
-
const recordedRevision = optionalDigest(input.revision, "review revision");
|
|
638
|
-
return {
|
|
639
|
-
pins,
|
|
640
|
-
stale: input.current === false || recordedRevision !== void 0 && recordedRevision !== revision || pins.some((pin) => !pin.current),
|
|
641
|
-
ambiguous: input.ambiguous === true
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
|
-
function handoffState(handoff, designId, revision, selectedVariant) {
|
|
645
|
-
if (!handoff) return "blocked";
|
|
646
|
-
if (handoff.status !== "approved" || !handoff.approval || handoff.approval.contentHash !== handoff.contentHash)
|
|
647
|
-
return "blocked";
|
|
648
|
-
const basisRevision = optionalDigest(handoff.basis?.sourceRevision, "review handoff revision");
|
|
649
|
-
if (handoff.current === false || handoff.basis?.designId !== designId || basisRevision !== revision || handoff.basis?.selectedVariant !== selectedVariant)
|
|
650
|
-
return "stale";
|
|
651
|
-
return "pass";
|
|
652
|
-
}
|
|
653
|
-
function compileDesignHandoffReadiness(input) {
|
|
654
|
-
if (input === null || input === void 0) return designHandoffReadinessAbsence();
|
|
655
|
-
const source = plainClone(input);
|
|
656
|
-
const document = source.document;
|
|
657
|
-
if (!document || document.kind !== "openplanr-design-document" || !["1.0.0", "1.1.0"].includes(document.schemaVersion) || typeof document.id !== "string" || !document.id)
|
|
658
|
-
throw new TypeError("Readiness requires one supported design document.");
|
|
659
|
-
const revision = source.sourceRevision === null || source.sourceRevision === void 0 ? null : normalizeDigest(source.sourceRevision, "design revision");
|
|
660
|
-
const direction = selectedDirection(document, source.studioState);
|
|
661
|
-
const evidenceItems = [];
|
|
662
|
-
if (revision)
|
|
663
|
-
evidenceItems.push(
|
|
664
|
-
evidence(
|
|
665
|
-
"design-revision",
|
|
666
|
-
"design-revision",
|
|
667
|
-
logicalPath(source.documentPath, "design-document.json", "design document path"),
|
|
668
|
-
document,
|
|
669
|
-
{ revision }
|
|
670
|
-
)
|
|
671
|
-
);
|
|
672
|
-
const directionEvidence = direction.selected && revision ? evidence(
|
|
673
|
-
"selected-direction",
|
|
674
|
-
"selected-direction",
|
|
675
|
-
logicalPath(source.studioStatePath, ".design/studio-state.json", "Studio state path"),
|
|
676
|
-
{ selectedVariant: direction.selected },
|
|
677
|
-
{ revision, anchor: { section: direction.selected } }
|
|
678
|
-
) : null;
|
|
679
|
-
if (directionEvidence) evidenceItems.push(directionEvidence);
|
|
680
|
-
const specification = source.specification;
|
|
681
|
-
if (specification)
|
|
682
|
-
evidenceItems.push(
|
|
683
|
-
evidence(
|
|
684
|
-
"design-specification",
|
|
685
|
-
"design-specification",
|
|
686
|
-
logicalPath(specification.path, "design-spec.md", "design specification path"),
|
|
687
|
-
specification,
|
|
688
|
-
{ revision: specification.revision }
|
|
689
|
-
)
|
|
690
|
-
);
|
|
691
|
-
const verification = source.verification;
|
|
692
|
-
if (verification)
|
|
693
|
-
evidenceItems.push(
|
|
694
|
-
evidence(
|
|
695
|
-
"rendered-verification",
|
|
696
|
-
"rendered-verification",
|
|
697
|
-
logicalPath(verification.path, ".design/verification/current.json", "verification path"),
|
|
698
|
-
verification,
|
|
699
|
-
{ revision: verification.revision }
|
|
700
|
-
)
|
|
701
|
-
);
|
|
702
|
-
const review = reviewState(source.review, revision);
|
|
703
|
-
if (source.review)
|
|
704
|
-
evidenceItems.push(
|
|
705
|
-
evidence(
|
|
706
|
-
"review-feedback",
|
|
707
|
-
"review-feedback",
|
|
708
|
-
logicalPath(source.review.path, ".design/review.json", "review feedback path"),
|
|
709
|
-
source.review,
|
|
710
|
-
{ revision: source.review.revision }
|
|
711
|
-
)
|
|
712
|
-
);
|
|
713
|
-
const handoff = source.reviewHandoff;
|
|
714
|
-
if (handoff)
|
|
715
|
-
evidenceItems.push(
|
|
716
|
-
evidence(
|
|
717
|
-
"review-handoff",
|
|
718
|
-
"review-handoff",
|
|
719
|
-
logicalPath(handoff.path, "review-handoff.json", "review handoff path"),
|
|
720
|
-
handoff,
|
|
721
|
-
{ revision: handoff.basis?.sourceRevision }
|
|
722
|
-
)
|
|
723
|
-
);
|
|
724
|
-
const checks = [];
|
|
725
|
-
checks.push(
|
|
726
|
-
checked("current-revision", revision ? "pass" : "blocked", revision ? ["design-revision"] : [])
|
|
727
|
-
);
|
|
728
|
-
const handoffDirection = handoff?.basis?.selectedVariant;
|
|
729
|
-
const directionStatus = !direction.ready ? "blocked" : handoffDirection && handoffDirection !== direction.selected ? "stale" : "pass";
|
|
730
|
-
checks.push(
|
|
731
|
-
checked("selected-direction", directionStatus, directionEvidence ? ["selected-direction"] : [])
|
|
732
|
-
);
|
|
733
|
-
let specificationStatus = "blocked";
|
|
734
|
-
if (specification?.complete === true) {
|
|
735
|
-
const specificationRevision = optionalDigest(
|
|
736
|
-
specification.revision,
|
|
737
|
-
"design specification revision"
|
|
738
|
-
);
|
|
739
|
-
specificationStatus = revision && specificationRevision && specificationRevision !== revision ? "stale" : "pass";
|
|
740
|
-
}
|
|
741
|
-
checks.push(
|
|
742
|
-
checked(
|
|
743
|
-
"design-specification",
|
|
744
|
-
specificationStatus,
|
|
745
|
-
specification ? ["design-specification"] : []
|
|
746
|
-
)
|
|
747
|
-
);
|
|
748
|
-
let verificationStatus = "blocked";
|
|
749
|
-
if (verification) {
|
|
750
|
-
const verificationRevision = optionalDigest(
|
|
751
|
-
verification.revision,
|
|
752
|
-
"rendered verification revision"
|
|
753
|
-
);
|
|
754
|
-
if (revision && verificationRevision && verificationRevision !== revision)
|
|
755
|
-
verificationStatus = "stale";
|
|
756
|
-
else if (verification.status === "verified") verificationStatus = "pass";
|
|
757
|
-
}
|
|
758
|
-
checks.push(
|
|
759
|
-
checked(
|
|
760
|
-
"rendered-verification",
|
|
761
|
-
verificationStatus,
|
|
762
|
-
verification ? ["rendered-verification"] : []
|
|
763
|
-
)
|
|
764
|
-
);
|
|
765
|
-
const reviewRefs = source.review ? ["review-feedback"] : [];
|
|
766
|
-
const freshnessStatus = review.ambiguous ? "blocked" : review.stale ? "stale" : "pass";
|
|
767
|
-
checks.push(checked("review-freshness", freshnessStatus, reviewRefs));
|
|
768
|
-
const undecided = review.pins.filter(
|
|
769
|
-
(pin) => pin.current && !["accepted", "deferred", "rejected"].includes(pin.disposition)
|
|
770
|
-
);
|
|
771
|
-
const invalidDisposition = review.pins.some(
|
|
772
|
-
(pin) => pin.disposition && !["accepted", "deferred", "rejected"].includes(pin.disposition)
|
|
773
|
-
);
|
|
774
|
-
const dispositionStatus = invalidDisposition || review.ambiguous ? "blocked" : undecided.length ? "attention" : "pass";
|
|
775
|
-
checks.push(checked("review-dispositions", dispositionStatus, reviewRefs));
|
|
776
|
-
const openBlockers = review.pins.filter(
|
|
777
|
-
(pin) => pin.current && ["blocker", "change-request"].includes(pin.category) && !["accepted", "deferred", "rejected"].includes(pin.disposition)
|
|
778
|
-
);
|
|
779
|
-
const staleAccepted = review.pins.some((pin) => !pin.current && pin.disposition === "accepted");
|
|
780
|
-
const blockerStatus = staleAccepted ? "stale" : openBlockers.length ? "blocked" : "pass";
|
|
781
|
-
checks.push(checked("unresolved-blockers", blockerStatus, reviewRefs));
|
|
782
|
-
const approvalStatus = handoffState(handoff, document.id, revision, direction.selected);
|
|
783
|
-
checks.push(
|
|
784
|
-
checked("approved-review-handoff", approvalStatus, handoff ? ["review-handoff"] : [])
|
|
785
|
-
);
|
|
786
|
-
if (checks.map((item) => item.id).join("\n") !== CHECKS.join("\n"))
|
|
787
|
-
throw new TypeError("Readiness checks are not in canonical order.");
|
|
788
|
-
const worst = checks.reduce(
|
|
789
|
-
(current, item) => priority[item.status] > priority[current] ? item.status : current,
|
|
790
|
-
"pass"
|
|
791
|
-
);
|
|
792
|
-
const status = worst === "pass" ? "ready" : worst;
|
|
793
|
-
const blockers = checks.filter((item) => ["blocked", "stale"].includes(item.status)).map((item) => item.id);
|
|
794
|
-
const nextActions = checks.filter((item) => item.status !== "pass").map((item) => item.recoveryAction);
|
|
795
|
-
return assertDesignHandoffReadiness({
|
|
796
|
-
kind: "openplanr-design-handoff-readiness",
|
|
797
|
-
schemaVersion: "1.0.0",
|
|
798
|
-
scope: "design-originated",
|
|
799
|
-
authority: "none",
|
|
800
|
-
designId: document.id,
|
|
801
|
-
sourceRevision: revision,
|
|
802
|
-
selectedVariant: direction.selected,
|
|
803
|
-
status,
|
|
804
|
-
continuation: { action: "prepare-plan", available: ["ready", "attention"].includes(status) },
|
|
805
|
-
checks,
|
|
806
|
-
evidence: evidenceItems.sort((left, right) => left.id.localeCompare(right.id)),
|
|
807
|
-
blockers,
|
|
808
|
-
nextActions
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
|
-
function designHandoffReadinessAbsence(reason = "not-computed") {
|
|
812
|
-
return assertDesignHandoffReadiness({
|
|
813
|
-
kind: "openplanr-design-handoff-readiness-absence",
|
|
814
|
-
schemaVersion: "1.0.0",
|
|
815
|
-
status: "absent",
|
|
816
|
-
reason,
|
|
817
|
-
message: "No design handoff readiness has been prepared.",
|
|
818
|
-
nextAction: {
|
|
819
|
-
id: "inspect-design",
|
|
820
|
-
label: "Open the design when you want to prepare a handoff"
|
|
821
|
-
}
|
|
822
|
-
});
|
|
823
|
-
}
|
|
824
|
-
function designHandoffReadinessDigest(value) {
|
|
825
|
-
assertDesignHandoffReadiness(value);
|
|
826
|
-
return `sha256:${sha256Hex(canonicalizeJson(value))}`;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
// packages/design/lib/design/handoff-resolution.mjs
|
|
830
|
-
var OUTCOMES = /* @__PURE__ */ new Set(["accepted", "open", "blocking", "deferred", "declined"]);
|
|
831
|
-
var CATEGORIES = /* @__PURE__ */ new Set(["question", "suggestion", "change-request", "blocker"]);
|
|
832
|
-
var DISPOSITIONS = /* @__PURE__ */ new Set(["accepted", "deferred", "rejected", "declined"]);
|
|
833
|
-
var MAX_COMMENTS = 1e4;
|
|
834
|
-
var MAX_ISSUES = 1e4;
|
|
835
|
-
var digestPattern2 = /^[a-f0-9]{64}$/u;
|
|
836
|
-
var revisionOf = (pin) => pin.revisionId ?? pin.reviewId;
|
|
837
|
-
var keyOf = (pin) => `${revisionOf(pin)}:${pin.id}`;
|
|
838
|
-
var compare = (left, right) => left.localeCompare(right, "en");
|
|
839
|
-
var clone = (value) => {
|
|
840
|
-
assertPlainData(value, "Review resolution data");
|
|
841
|
-
return JSON.parse(canonicalizeJson(value));
|
|
842
|
-
};
|
|
843
|
-
function issue(code, severity, message2, { pinId, revisionId, recoveryAction } = {}) {
|
|
844
|
-
return {
|
|
845
|
-
code,
|
|
846
|
-
severity,
|
|
847
|
-
message: message2,
|
|
848
|
-
...revisionId ? { revisionId } : {},
|
|
849
|
-
...pinId ? { pinId } : {},
|
|
850
|
-
recoveryAction: recoveryAction ?? {
|
|
851
|
-
id: "refresh-review-resolution",
|
|
852
|
-
label: "Refresh review decisions"
|
|
853
|
-
}
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
function validatePin(pin) {
|
|
857
|
-
if (!pin || typeof pin !== "object" || Array.isArray(pin))
|
|
858
|
-
throw new TypeError("Every review comment must be an object.");
|
|
859
|
-
if (typeof pin.id !== "string" || !pin.id || pin.id.length > 160)
|
|
860
|
-
throw new TypeError("Every review comment requires a stable identity.");
|
|
861
|
-
const revisionId = revisionOf(pin);
|
|
862
|
-
if (typeof revisionId !== "string" || !revisionId || revisionId.length > 160)
|
|
863
|
-
throw new TypeError("Every review comment requires its original revision identity.");
|
|
864
|
-
if (typeof pin.reviewOf !== "string" || !digestPattern2.test(pin.reviewOf))
|
|
865
|
-
throw new TypeError("Every review comment requires its original review basis.");
|
|
866
|
-
if (pin.screenId !== void 0 && (typeof pin.screenId !== "string" || !pin.screenId))
|
|
867
|
-
throw new TypeError("Review screen references must be stable identities.");
|
|
868
|
-
if (pin.elementId !== void 0 && (typeof pin.elementId !== "string" || !pin.elementId || !pin.screenId))
|
|
869
|
-
throw new TypeError("Review element references require a stable screen identity.");
|
|
870
|
-
}
|
|
871
|
-
function scopedMetadata(metadata2, pin, duplicatePinIds, diagnostics) {
|
|
872
|
-
const revisionId = revisionOf(pin);
|
|
873
|
-
const scoped = metadata2.byRevision?.[revisionId] ?? {};
|
|
874
|
-
let category = scoped.categories?.[pin.id];
|
|
875
|
-
let disposition = scoped.dispositions?.[pin.id];
|
|
876
|
-
if (category === void 0 && Object.hasOwn(metadata2.categories ?? {}, pin.id)) {
|
|
877
|
-
if (duplicatePinIds.has(pin.id))
|
|
878
|
-
diagnostics.push(
|
|
879
|
-
issue(
|
|
880
|
-
"AMBIGUOUS_LEGACY_CATEGORY",
|
|
881
|
-
"blocked",
|
|
882
|
-
"A legacy category cannot be matched to one original revision.",
|
|
883
|
-
{ pinId: pin.id, revisionId }
|
|
884
|
-
)
|
|
885
|
-
);
|
|
886
|
-
else category = metadata2.categories[pin.id];
|
|
887
|
-
}
|
|
888
|
-
if (disposition === void 0 && Object.hasOwn(metadata2.dispositions ?? {}, pin.id)) {
|
|
889
|
-
if (duplicatePinIds.has(pin.id))
|
|
890
|
-
diagnostics.push(
|
|
891
|
-
issue(
|
|
892
|
-
"AMBIGUOUS_LEGACY_DISPOSITION",
|
|
893
|
-
"blocked",
|
|
894
|
-
"A legacy owner decision cannot be matched to one original revision.",
|
|
895
|
-
{ pinId: pin.id, revisionId }
|
|
896
|
-
)
|
|
897
|
-
);
|
|
898
|
-
else disposition = metadata2.dispositions[pin.id];
|
|
899
|
-
}
|
|
900
|
-
if (category !== void 0 && !CATEGORIES.has(category)) {
|
|
901
|
-
diagnostics.push(
|
|
902
|
-
issue("UNKNOWN_CATEGORY", "blocked", "The comment category is not supported.", {
|
|
903
|
-
pinId: pin.id,
|
|
904
|
-
revisionId
|
|
905
|
-
})
|
|
906
|
-
);
|
|
907
|
-
category = void 0;
|
|
908
|
-
}
|
|
909
|
-
const dispositionValue = typeof disposition === "string" ? disposition : disposition?.disposition;
|
|
910
|
-
if (dispositionValue !== void 0 && !DISPOSITIONS.has(dispositionValue)) {
|
|
911
|
-
diagnostics.push(
|
|
912
|
-
issue("UNKNOWN_DISPOSITION", "blocked", "The owner decision is not supported.", {
|
|
913
|
-
pinId: pin.id,
|
|
914
|
-
revisionId
|
|
915
|
-
})
|
|
916
|
-
);
|
|
917
|
-
disposition = void 0;
|
|
918
|
-
}
|
|
919
|
-
return {
|
|
920
|
-
category,
|
|
921
|
-
disposition,
|
|
922
|
-
dispositionValue: typeof disposition === "string" ? disposition : disposition?.disposition
|
|
923
|
-
};
|
|
924
|
-
}
|
|
925
|
-
function unknownMetadata(metadata2, known, diagnostics) {
|
|
926
|
-
for (const [revisionId, value] of Object.entries(metadata2.byRevision ?? {}).sort(
|
|
927
|
-
([left], [right]) => compare(left, right)
|
|
928
|
-
)) {
|
|
929
|
-
for (const field of ["categories", "dispositions"]) {
|
|
930
|
-
for (const pinId of Object.keys(value?.[field] ?? {}).sort(compare)) {
|
|
931
|
-
if (!known.has(`${revisionId}:${pinId}`))
|
|
932
|
-
diagnostics.push(
|
|
933
|
-
issue(
|
|
934
|
-
"UNKNOWN_COMMENT_METADATA",
|
|
935
|
-
"blocked",
|
|
936
|
-
"Review metadata targets a comment that is not present in the recorded review history.",
|
|
937
|
-
{ revisionId, pinId }
|
|
938
|
-
)
|
|
939
|
-
);
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
function compileDesignHandoffResolution(input) {
|
|
945
|
-
const source = clone(input ?? {});
|
|
946
|
-
const pins = Array.isArray(source.pins) ? source.pins : [];
|
|
947
|
-
if (pins.length > MAX_COMMENTS)
|
|
948
|
-
throw new RangeError("Review resolution exceeds the comment limit.");
|
|
949
|
-
const metadata2 = source.metadata && typeof source.metadata === "object" && !Array.isArray(source.metadata) ? source.metadata : {};
|
|
950
|
-
const diagnostics = [];
|
|
951
|
-
const counts = /* @__PURE__ */ new Map();
|
|
952
|
-
for (const pin of pins) {
|
|
953
|
-
validatePin(pin);
|
|
954
|
-
counts.set(pin.id, (counts.get(pin.id) ?? 0) + 1);
|
|
955
|
-
}
|
|
956
|
-
const duplicatePinIds = new Set([...counts].filter(([, count]) => count > 1).map(([id2]) => id2));
|
|
957
|
-
const known = /* @__PURE__ */ new Set();
|
|
958
|
-
for (const pin of pins) {
|
|
959
|
-
const key = keyOf(pin);
|
|
960
|
-
if (known.has(key)) throw new TypeError(`Duplicate review comment identity: ${key}.`);
|
|
961
|
-
known.add(key);
|
|
962
|
-
}
|
|
963
|
-
unknownMetadata(metadata2, known, diagnostics);
|
|
964
|
-
const items = [...pins].sort((left, right) => compare(keyOf(left), keyOf(right))).map((pin) => {
|
|
965
|
-
const revisionId = revisionOf(pin);
|
|
966
|
-
const current = pin.stale !== true && (!source.currentReviewOf || pin.reviewOf === source.currentReviewOf);
|
|
967
|
-
const resolved = scopedMetadata(metadata2, pin, duplicatePinIds, diagnostics);
|
|
968
|
-
let outcome;
|
|
969
|
-
if (resolved.dispositionValue === "accepted") outcome = "accepted";
|
|
970
|
-
else if (resolved.dispositionValue === "deferred") outcome = "deferred";
|
|
971
|
-
else if (["rejected", "declined"].includes(resolved.dispositionValue)) outcome = "declined";
|
|
972
|
-
else if (["blocker", "change-request"].includes(resolved.category)) outcome = "blocking";
|
|
973
|
-
else outcome = "open";
|
|
974
|
-
if (!OUTCOMES.has(outcome)) throw new Error("Review resolution produced an invalid outcome.");
|
|
975
|
-
if (!current && outcome === "accepted")
|
|
976
|
-
diagnostics.push(
|
|
977
|
-
issue(
|
|
978
|
-
"STALE_ACCEPTED_DECISION",
|
|
979
|
-
"stale",
|
|
980
|
-
"An accepted change belongs to an earlier design revision and must be reviewed again.",
|
|
981
|
-
{
|
|
982
|
-
pinId: pin.id,
|
|
983
|
-
revisionId,
|
|
984
|
-
recoveryAction: {
|
|
985
|
-
id: "review-stale-decision",
|
|
986
|
-
label: "Review this decision against the current design"
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
)
|
|
990
|
-
);
|
|
991
|
-
if (current && outcome === "blocking")
|
|
992
|
-
diagnostics.push(
|
|
993
|
-
issue(
|
|
994
|
-
"UNRESOLVED_BLOCKING_COMMENT",
|
|
995
|
-
"blocked",
|
|
996
|
-
"A blocking comment still needs an owner decision.",
|
|
997
|
-
{
|
|
998
|
-
pinId: pin.id,
|
|
999
|
-
revisionId,
|
|
1000
|
-
recoveryAction: {
|
|
1001
|
-
id: "resolve-blocking-comment",
|
|
1002
|
-
label: "Record the owner decision"
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
)
|
|
1006
|
-
);
|
|
1007
|
-
return {
|
|
1008
|
-
id: keyOf(pin),
|
|
1009
|
-
pinId: pin.id,
|
|
1010
|
-
reviewId: pin.reviewId,
|
|
1011
|
-
revisionId,
|
|
1012
|
-
reviewOf: pin.reviewOf,
|
|
1013
|
-
current,
|
|
1014
|
-
category: resolved.category ?? "question",
|
|
1015
|
-
outcome,
|
|
1016
|
-
implementationScope: current && outcome === "accepted",
|
|
1017
|
-
anchor: pin.elementId ? { screenId: pin.screenId, elementId: pin.elementId } : pin.screenId ? { screenId: pin.screenId } : pin.anchor?.planrId ? { planrId: pin.anchor.planrId } : { artifactId: pin.artifactId },
|
|
1018
|
-
source: {
|
|
1019
|
-
text: pin.comment,
|
|
1020
|
-
author: clone(pin.author),
|
|
1021
|
-
status: pin.status,
|
|
1022
|
-
...resolved.disposition && typeof resolved.disposition === "object" ? { decision: clone(resolved.disposition) } : {}
|
|
1023
|
-
}
|
|
1024
|
-
};
|
|
1025
|
-
});
|
|
1026
|
-
if (source.historyComplete === false)
|
|
1027
|
-
diagnostics.push(
|
|
1028
|
-
issue("INCOMPLETE_REVIEW_HISTORY", "blocked", "The complete review history is unavailable.", {
|
|
1029
|
-
recoveryAction: {
|
|
1030
|
-
id: "restore-review-history",
|
|
1031
|
-
label: "Restore the complete review history"
|
|
1032
|
-
}
|
|
1033
|
-
})
|
|
1034
|
-
);
|
|
1035
|
-
if (source.synchronizationPending === true)
|
|
1036
|
-
diagnostics.push(
|
|
1037
|
-
issue(
|
|
1038
|
-
"SYNCHRONIZATION_PENDING",
|
|
1039
|
-
"blocked",
|
|
1040
|
-
"A review decision is still waiting to synchronize.",
|
|
1041
|
-
{
|
|
1042
|
-
recoveryAction: {
|
|
1043
|
-
id: "retry-review-sync",
|
|
1044
|
-
label: "Retry review synchronization"
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
)
|
|
1048
|
-
);
|
|
1049
|
-
for (const value of (source.synchronizationIssues ?? []).slice(0, MAX_ISSUES))
|
|
1050
|
-
diagnostics.push(
|
|
1051
|
-
issue(
|
|
1052
|
-
"UNTRUSTED_HOSTED_FEEDBACK",
|
|
1053
|
-
"blocked",
|
|
1054
|
-
value?.reason || "Hosted feedback could not be validated.",
|
|
1055
|
-
{
|
|
1056
|
-
pinId: value?.pinId,
|
|
1057
|
-
revisionId: value?.revisionId,
|
|
1058
|
-
recoveryAction: {
|
|
1059
|
-
id: "inspect-review-sync",
|
|
1060
|
-
label: "Inspect the rejected hosted feedback"
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
)
|
|
1064
|
-
);
|
|
1065
|
-
if ((source.synchronizationIssues ?? []).length > MAX_ISSUES)
|
|
1066
|
-
throw new RangeError("Review resolution exceeds the synchronization issue limit.");
|
|
1067
|
-
diagnostics.sort(
|
|
1068
|
-
(left, right) => compare(
|
|
1069
|
-
`${left.code}:${left.revisionId ?? ""}:${left.pinId ?? ""}:${left.message}`,
|
|
1070
|
-
`${right.code}:${right.revisionId ?? ""}:${right.pinId ?? ""}:${right.message}`
|
|
1071
|
-
)
|
|
1072
|
-
);
|
|
1073
|
-
const severity = new Set(diagnostics.map((value) => value.severity));
|
|
1074
|
-
const status = severity.has("stale") ? "stale" : severity.has("blocked") ? "blocked" : items.some((item) => item.outcome === "open") ? "attention" : "ready";
|
|
1075
|
-
return {
|
|
1076
|
-
kind: "openplanr-design-handoff-resolution",
|
|
1077
|
-
schemaVersion: "1.0.0",
|
|
1078
|
-
currentReviewOf: source.currentReviewOf ?? null,
|
|
1079
|
-
status,
|
|
1080
|
-
complete: source.historyComplete !== false && !["blocked", "stale"].includes(status),
|
|
1081
|
-
items,
|
|
1082
|
-
implementationScope: items.filter((item) => item.implementationScope).map((item) => item.id),
|
|
1083
|
-
diagnostics
|
|
1084
|
-
};
|
|
1085
|
-
}
|
|
1086
|
-
function canApproveDesignHandoffResolution(value) {
|
|
1087
|
-
return Boolean(value?.complete && ["ready", "attention"].includes(value.status));
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
// packages/design/lib/design/handoff-reader.mjs
|
|
1091
|
-
var sections = ["agreedChanges", "openQuestions", "deferred", "rejected"];
|
|
1092
|
-
var metadataPath = (current) => join2(current.root, ".design/review-metadata.json");
|
|
1093
|
-
var revisionOf2 = (pin) => pin.revisionId ?? pin.reviewId;
|
|
1094
|
-
var pinKey = (pin) => `${revisionOf2(pin)}:${pin.id}`;
|
|
1095
|
-
function metadata(current, feedback) {
|
|
1096
|
-
const local = readJson(metadataPath(current), { version: 0, byRevision: {} });
|
|
1097
|
-
const byRevision = structuredClone(feedback.shared?.metadataByRevision ?? {});
|
|
1098
|
-
for (const [revision, value] of Object.entries(local.byRevision ?? {})) {
|
|
1099
|
-
const remote = byRevision[revision] ?? {};
|
|
1100
|
-
byRevision[revision] = {
|
|
1101
|
-
categories: { ...remote.categories, ...value.categories },
|
|
1102
|
-
dispositions: { ...remote.dispositions, ...value.dispositions }
|
|
1103
|
-
};
|
|
1104
|
-
}
|
|
1105
|
-
const counts = /* @__PURE__ */ new Map();
|
|
1106
|
-
for (const pin of feedback.pins) counts.set(pin.id, (counts.get(pin.id) ?? 0) + 1);
|
|
1107
|
-
const categories = {}, dispositions = {};
|
|
1108
|
-
for (const pin of feedback.pins) {
|
|
1109
|
-
const value = byRevision[revisionOf2(pin)];
|
|
1110
|
-
if (counts.get(pin.id) === 1 && value) {
|
|
1111
|
-
if (Object.hasOwn(value.categories ?? {}, pin.id))
|
|
1112
|
-
Object.defineProperty(categories, pin.id, {
|
|
1113
|
-
value: value.categories[pin.id],
|
|
1114
|
-
enumerable: true
|
|
1115
|
-
});
|
|
1116
|
-
if (Object.hasOwn(value.dispositions ?? {}, pin.id))
|
|
1117
|
-
Object.defineProperty(dispositions, pin.id, {
|
|
1118
|
-
value: value.dispositions[pin.id],
|
|
1119
|
-
enumerable: true
|
|
1120
|
-
});
|
|
1121
|
-
}
|
|
1122
|
-
if (counts.get(pin.id) === 1 && !Object.hasOwn(categories, pin.id) && Object.hasOwn(local.categories ?? {}, pin.id))
|
|
1123
|
-
Object.defineProperty(categories, pin.id, {
|
|
1124
|
-
value: local.categories[pin.id],
|
|
1125
|
-
enumerable: true
|
|
1126
|
-
});
|
|
1127
|
-
if (counts.get(pin.id) === 1 && !Object.hasOwn(dispositions, pin.id) && Object.hasOwn(local.dispositions ?? {}, pin.id))
|
|
1128
|
-
Object.defineProperty(dispositions, pin.id, {
|
|
1129
|
-
value: local.dispositions[pin.id],
|
|
1130
|
-
enumerable: true
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1133
|
-
return {
|
|
1134
|
-
version: local.version,
|
|
1135
|
-
categories,
|
|
1136
|
-
dispositions,
|
|
1137
|
-
byRevision,
|
|
1138
|
-
legacy: {
|
|
1139
|
-
categories: structuredClone(local.categories ?? {}),
|
|
1140
|
-
dispositions: structuredClone(local.dispositions ?? {})
|
|
1141
|
-
}
|
|
1142
|
-
};
|
|
1143
|
-
}
|
|
1144
|
-
function findPin(pins, id2, revision) {
|
|
1145
|
-
const candidates = pins.filter(
|
|
1146
|
-
(pin) => pin.id === id2 && (!revision || revisionOf2(pin) === revision)
|
|
1147
|
-
);
|
|
1148
|
-
if (candidates.length !== 1)
|
|
1149
|
-
throw new Error(
|
|
1150
|
-
"The comment identity is missing or ambiguous. Include its original revisionId."
|
|
1151
|
-
);
|
|
1152
|
-
return candidates[0];
|
|
1153
|
-
}
|
|
1154
|
-
function resolutionFor(value, shareStatus) {
|
|
1155
|
-
return compileDesignHandoffResolution({
|
|
1156
|
-
currentReviewOf: value.basis.reviewOf,
|
|
1157
|
-
pins: value.feedback.pins,
|
|
1158
|
-
metadata: {
|
|
1159
|
-
byRevision: value.metadata.byRevision,
|
|
1160
|
-
categories: value.metadata.legacy.categories,
|
|
1161
|
-
dispositions: value.metadata.legacy.dispositions
|
|
1162
|
-
},
|
|
1163
|
-
historyComplete: !value.feedback.shared?.issues?.length,
|
|
1164
|
-
synchronizationPending: Boolean(shareStatus?.pendingReviewMetadata),
|
|
1165
|
-
synchronizationIssues: value.feedback.shared?.issues ?? []
|
|
1166
|
-
});
|
|
1167
|
-
}
|
|
1168
|
-
function snapshot(file, env, shareOptions = {}) {
|
|
1169
|
-
const current = currentDesign(file, shareOptions), feedback = readDesignFeedback(file, env, shareOptions), meta = metadata(current, feedback);
|
|
1170
|
-
const reviewContext = current.reviewContext ?? emptyReviewContext(current.document);
|
|
1171
|
-
const basis = {
|
|
1172
|
-
designId: current.document.id,
|
|
1173
|
-
sourceRevision: current.revision,
|
|
1174
|
-
contextDigest: current.contextDigest ?? reviewDigest(reviewContext),
|
|
1175
|
-
reviewOf: digestArtifactEnvelope(current.envelope),
|
|
1176
|
-
selectedVariant: feedback.state.selectedVariant ?? current.document.selectedVariant,
|
|
1177
|
-
feedbackDigest: reviewDigest({
|
|
1178
|
-
pins: feedback.pins,
|
|
1179
|
-
metadata: {
|
|
1180
|
-
byRevision: meta.byRevision,
|
|
1181
|
-
categories: meta.categories,
|
|
1182
|
-
dispositions: meta.dispositions
|
|
1183
|
-
},
|
|
1184
|
-
overall: (feedback.ledger?.reviews ?? []).map((entry) => ({
|
|
1185
|
-
reviewId: entry.review.reviewId,
|
|
1186
|
-
reviewOf: entry.review.reviewOf,
|
|
1187
|
-
overall: entry.review.overall
|
|
1188
|
-
})),
|
|
1189
|
-
directions: feedback.shared?.directions ?? []
|
|
1190
|
-
}),
|
|
1191
|
-
verificationDigest: reviewDigest(current.verification),
|
|
1192
|
-
feedbackWatermark: Math.max(
|
|
1193
|
-
0,
|
|
1194
|
-
...(feedback.shared?.events ?? []).map((event) => event.sequence ?? 0)
|
|
1195
|
-
)
|
|
1196
|
-
};
|
|
1197
|
-
let shareStatus = null;
|
|
1198
|
-
try {
|
|
1199
|
-
shareStatus = getDesignShareStatus(file, { env, ...shareOptions });
|
|
1200
|
-
} catch (error) {
|
|
1201
|
-
if (error.code === "E_DESIGN_PUBLICATION_PENDING") throw error;
|
|
1202
|
-
}
|
|
1203
|
-
const value = { current, feedback, metadata: meta, reviewContext, basis };
|
|
1204
|
-
return { ...value, resolution: resolutionFor(value, shareStatus), shareStatus };
|
|
1205
|
-
}
|
|
1206
|
-
function readDesignExperience(file, { env = process.env } = {}) {
|
|
1207
|
-
const value = snapshot(file, env);
|
|
1208
|
-
return {
|
|
1209
|
-
ok: true,
|
|
1210
|
-
capabilities: { owner: true, revisions: true, handoff: true },
|
|
1211
|
-
revision: value.current.revision,
|
|
1212
|
-
reviewContext: value.reviewContext,
|
|
1213
|
-
contextDigest: value.basis.contextDigest,
|
|
1214
|
-
fingerprints: value.current.fingerprints ?? [],
|
|
1215
|
-
metadata: value.metadata,
|
|
1216
|
-
loadingHistory: false
|
|
1217
|
-
};
|
|
1218
|
-
}
|
|
1219
|
-
function readDesignHandoff(file, { env = process.env, ...shareOptions } = {}) {
|
|
1220
|
-
const value = snapshot(file, env, shareOptions);
|
|
1221
|
-
const path = join2(dirname(designSpecPath(value.current.root)), "review-handoff.json");
|
|
1222
|
-
const draft = readJson(path, null);
|
|
1223
|
-
if (draft) {
|
|
1224
|
-
assertDraft(draft);
|
|
1225
|
-
const markdownPath = path.replace(/\.json$/u, ".md");
|
|
1226
|
-
if (!existsSync(markdownPath) || readFileSync(markdownPath, "utf8") !== draft.markdown)
|
|
1227
|
-
throw new Error(
|
|
1228
|
-
"The handoff Markdown differs from its approved JSON. Rebuild the handoff projection before using it in Plan."
|
|
1229
|
-
);
|
|
1230
|
-
}
|
|
1231
|
-
return {
|
|
1232
|
-
ok: true,
|
|
1233
|
-
path,
|
|
1234
|
-
revision: value.current.revision,
|
|
1235
|
-
draft,
|
|
1236
|
-
current: Boolean(draft && reviewDigest(draft.basis) === reviewDigest(value.basis)),
|
|
1237
|
-
metadata: value.metadata,
|
|
1238
|
-
feedback: { pins: value.feedback.pins },
|
|
1239
|
-
basis: value.basis,
|
|
1240
|
-
resolution: value.resolution
|
|
1241
|
-
};
|
|
1242
|
-
}
|
|
1243
|
-
function readDesignHandoffReadiness(file, { env = process.env, ...shareOptions } = {}) {
|
|
1244
|
-
const value = snapshot(file, env, shareOptions);
|
|
1245
|
-
const path = join2(dirname(designSpecPath(value.current.root)), "review-handoff.json");
|
|
1246
|
-
const handoff = readJson(path, null);
|
|
1247
|
-
if (handoff) assertDraft(handoff);
|
|
1248
|
-
const outcomes = new Map(value.resolution.items.map((item) => [item.id, item]));
|
|
1249
|
-
const pins = value.feedback.pins.map((pin) => {
|
|
1250
|
-
const resolved = outcomes.get(pinKey(pin));
|
|
1251
|
-
const disposition = resolved?.outcome === "accepted" ? "accepted" : resolved?.outcome === "deferred" ? "deferred" : resolved?.outcome === "declined" ? "rejected" : void 0;
|
|
1252
|
-
return {
|
|
1253
|
-
id: pin.id,
|
|
1254
|
-
...pin.screenId ? { screenId: pin.screenId } : {},
|
|
1255
|
-
...pin.anchor?.planrId ? { elementId: pin.anchor.planrId } : {},
|
|
1256
|
-
category: resolved?.category,
|
|
1257
|
-
...disposition ? { disposition } : {},
|
|
1258
|
-
stale: Boolean(pin.stale)
|
|
1259
|
-
};
|
|
1260
|
-
});
|
|
1261
|
-
const specificationPath = designSpecPath(value.current.root);
|
|
1262
|
-
const specification = existsSync(specificationPath) ? {
|
|
1263
|
-
path: "design-spec.md",
|
|
1264
|
-
revision: value.current.revision,
|
|
1265
|
-
digest: `sha256:${hash(readFileSync(specificationPath))}`,
|
|
1266
|
-
complete: true
|
|
1267
|
-
} : void 0;
|
|
1268
|
-
const studioState = readJson(join2(value.current.root, ".design/studio-state.json"), {
|
|
1269
|
-
state: {}
|
|
1270
|
-
}).state;
|
|
1271
|
-
const readiness = compileDesignHandoffReadiness({
|
|
1272
|
-
document: value.current.document,
|
|
1273
|
-
documentPath: "design-document.json",
|
|
1274
|
-
sourceRevision: value.current.revision,
|
|
1275
|
-
studioState,
|
|
1276
|
-
studioStatePath: ".design/studio-state.json",
|
|
1277
|
-
specification,
|
|
1278
|
-
verification: { path: ".design/verification/current.json", ...value.current.verification },
|
|
1279
|
-
review: {
|
|
1280
|
-
path: ".design/review.json",
|
|
1281
|
-
revision: value.current.revision,
|
|
1282
|
-
current: pins.every((pin) => !pin.stale),
|
|
1283
|
-
pins
|
|
1284
|
-
},
|
|
1285
|
-
reviewHandoff: handoff ? {
|
|
1286
|
-
...handoff,
|
|
1287
|
-
path: "review-handoff.json",
|
|
1288
|
-
digest: `sha256:${handoff.contentHash}`,
|
|
1289
|
-
current: reviewDigest(handoff.basis) === reviewDigest(value.basis)
|
|
1290
|
-
} : void 0
|
|
1291
|
-
});
|
|
1292
|
-
return { ok: true, readiness, digest: designHandoffReadinessDigest(readiness) };
|
|
1293
|
-
}
|
|
1294
|
-
function assertDraft(draft) {
|
|
1295
|
-
assertReviewExperience(draft, DESIGN_HANDOFF_SCHEMA);
|
|
1296
|
-
const expected = reviewDigest({
|
|
1297
|
-
title: draft.title,
|
|
1298
|
-
reviewNotes: draft.reviewNotes,
|
|
1299
|
-
basis: draft.basis,
|
|
1300
|
-
content: draft.content,
|
|
1301
|
-
affectedScreens: draft.affectedScreens ?? [],
|
|
1302
|
-
verificationGaps: draft.verificationGaps ?? []
|
|
1303
|
-
});
|
|
1304
|
-
if (draft.contentHash !== expected || draft.status === "approved" && draft.approval?.contentHash !== expected)
|
|
1305
|
-
throw new Error(
|
|
1306
|
-
"The handoff content does not match its approval digest. Refine it through the handoff utility."
|
|
1307
|
-
);
|
|
1308
|
-
if (draft.markdown !== renderMarkdown(draft, draft.title))
|
|
1309
|
-
throw new Error("The handoff Markdown does not match its approved content.");
|
|
1310
|
-
return draft;
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
// packages/design/lib/design/handoff.mjs
|
|
1314
|
-
import { existsSync as existsSync2, writeFileSync } from "node:fs";
|
|
1315
|
-
import { dirname as dirname2, join as join3 } from "node:path";
|
|
1316
|
-
var conflict = (message2) => Object.assign(new Error(message2), { statusCode: 409 });
|
|
1317
|
-
function sourceItem(pin, shareUrl) {
|
|
1318
|
-
const source = pin.revisionId ? `${shareUrl ?? ""}#revision=${encodeURIComponent(pin.revisionId)}&pin=${encodeURIComponent(pin.id)}` : `#review=${encodeURIComponent(pin.reviewId)}&pin=${encodeURIComponent(pin.id)}`;
|
|
1319
|
-
return {
|
|
1320
|
-
pinId: pin.id,
|
|
1321
|
-
...pin.screenId ? { screenId: pin.screenId } : {},
|
|
1322
|
-
reviewId: pin.reviewId,
|
|
1323
|
-
...pin.revisionId ? { revisionId: pin.revisionId } : {},
|
|
1324
|
-
text: pin.comment,
|
|
1325
|
-
author: pin.author.name,
|
|
1326
|
-
reviewOf: pin.reviewOf,
|
|
1327
|
-
stale: Boolean(pin.stale),
|
|
1328
|
-
source
|
|
1329
|
-
};
|
|
1330
|
-
}
|
|
1331
|
-
function contentFromFeedback(value, shareUrl) {
|
|
1332
|
-
const content = { summary: "", agreedChanges: [], openQuestions: [], deferred: [], rejected: [] };
|
|
1333
|
-
const pins = new Map(value.feedback.pins.map((pin) => [pinKey(pin), pin]));
|
|
1334
|
-
for (const resolved of value.resolution.items) {
|
|
1335
|
-
const pin = pins.get(resolved.id);
|
|
1336
|
-
const item = sourceItem(pin, shareUrl);
|
|
1337
|
-
if (resolved.outcome === "accepted") content.agreedChanges.push(item);
|
|
1338
|
-
else if (resolved.outcome === "deferred") content.deferred.push(item);
|
|
1339
|
-
else if (resolved.outcome === "declined") content.rejected.push(item);
|
|
1340
|
-
else content.openQuestions.push(item);
|
|
1341
|
-
}
|
|
1342
|
-
return content;
|
|
1343
|
-
}
|
|
1344
|
-
function enrichContent(content, value, shareUrl) {
|
|
1345
|
-
assertReviewExperience(content, DESIGN_HANDOFF_CONTENT_SCHEMA);
|
|
1346
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1347
|
-
const enriched = { summary: content.summary };
|
|
1348
|
-
for (const key of sections)
|
|
1349
|
-
enriched[key] = content[key].map((item) => {
|
|
1350
|
-
const pin = findPin(value.feedback.pins, item.pinId, item.revisionId ?? item.reviewId);
|
|
1351
|
-
if (seen.has(pinKey(pin)))
|
|
1352
|
-
throw new Error("Handoff items must cite distinct recorded comments.");
|
|
1353
|
-
seen.add(pinKey(pin));
|
|
1354
|
-
const resolved = value.resolution.items.find((itemValue) => itemValue.id === pinKey(pin));
|
|
1355
|
-
const expected = key === "agreedChanges" ? ["accepted"] : key === "deferred" ? ["deferred"] : key === "rejected" ? ["declined"] : ["open", "blocking"];
|
|
1356
|
-
if (!resolved || !expected.includes(resolved.outcome))
|
|
1357
|
-
throw new Error(
|
|
1358
|
-
"Record the owner disposition before moving a comment into this handoff section."
|
|
1359
|
-
);
|
|
1360
|
-
const refinement = item.refinement ?? (item.text !== pin.comment ? item.text : void 0);
|
|
1361
|
-
return { ...sourceItem(pin, shareUrl), ...refinement !== void 0 ? { refinement } : {} };
|
|
1362
|
-
});
|
|
1363
|
-
for (const pin of value.feedback.pins)
|
|
1364
|
-
if (!seen.has(pinKey(pin)))
|
|
1365
|
-
throw new Error(
|
|
1366
|
-
`Keep every recorded review comment in the handoff; ${pinKey(pin)} is missing.`
|
|
1367
|
-
);
|
|
1368
|
-
return enriched;
|
|
1369
|
-
}
|
|
1370
|
-
function normalizedLocalMetadata(local, pins) {
|
|
1371
|
-
const byRevision = structuredClone(local.byRevision ?? {});
|
|
1372
|
-
const counts = /* @__PURE__ */ new Map();
|
|
1373
|
-
for (const pin of pins) counts.set(pin.id, (counts.get(pin.id) ?? 0) + 1);
|
|
1374
|
-
for (const field of ["categories", "dispositions"]) {
|
|
1375
|
-
for (const [pinId, item] of Object.entries(local[field] ?? {})) {
|
|
1376
|
-
if (counts.get(pinId) !== 1) continue;
|
|
1377
|
-
const pin = pins.find((value) => value.id === pinId);
|
|
1378
|
-
const revision = revisionOf2(pin);
|
|
1379
|
-
const scoped = byRevision[revision] ?? { categories: {}, dispositions: {} };
|
|
1380
|
-
byRevision[revision] = { ...scoped, [field]: { ...scoped[field], [pinId]: item } };
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
return { version: local.version ?? 0, byRevision };
|
|
1384
|
-
}
|
|
1385
|
-
async function preserveReviewErrors(path, action3) {
|
|
1386
|
-
let failure, result;
|
|
1387
|
-
await withArtifactReviewLock(path, async () => {
|
|
1388
|
-
try {
|
|
1389
|
-
result = await action3();
|
|
1390
|
-
} catch (error) {
|
|
1391
|
-
failure = error;
|
|
1392
|
-
}
|
|
1393
|
-
});
|
|
1394
|
-
if (failure) throw failure;
|
|
1395
|
-
return result;
|
|
1396
|
-
}
|
|
1397
|
-
async function updateDesignHandoff(file, input, { env = process.env, fetchImpl = fetch, ...shareOptions } = {}) {
|
|
1398
|
-
if (!input || !["draft", "update", "approve", "category", "disposition"].includes(input.action))
|
|
1399
|
-
throw new Error("Unknown design handoff action.");
|
|
1400
|
-
const initial = currentDesign(file);
|
|
1401
|
-
const unlockRender = await acquireStartLock(join3(initial.root, ".design/render.lock"));
|
|
1402
|
-
let outgoing;
|
|
1403
|
-
try {
|
|
1404
|
-
const unlock = await acquireStartLock(join3(initial.root, ".design/handoff.lock"));
|
|
1405
|
-
try {
|
|
1406
|
-
await preserveReviewErrors(designReviewPath(file, env), async () => {
|
|
1407
|
-
const value = snapshot(file, env, shareOptions);
|
|
1408
|
-
if (input.revision !== value.current.revision)
|
|
1409
|
-
throw conflict("The design changed. Refresh the review before updating its handoff.");
|
|
1410
|
-
if (["category", "disposition"].includes(input.action)) {
|
|
1411
|
-
if (input.version !== value.metadata.version)
|
|
1412
|
-
throw conflict("Review organization changed in another window. Reload before saving.");
|
|
1413
|
-
const pin = findPin(value.feedback.pins, input.pinId, input.revisionId ?? input.reviewId);
|
|
1414
|
-
if (!pin) throw new Error("The comment is no longer available.");
|
|
1415
|
-
const choices = input.action === "category" ? ["question", "suggestion", "change-request", "blocker"] : ["accepted", "deferred", "rejected"];
|
|
1416
|
-
if (!choices.includes(input[input.action])) throw new Error(`Invalid ${input.action}.`);
|
|
1417
|
-
if (typeof (input.reason ?? "") !== "string" || (input.reason ?? "").length > 16384)
|
|
1418
|
-
throw new Error("Disposition reason is too long.");
|
|
1419
|
-
const updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1420
|
-
const local = normalizedLocalMetadata(
|
|
1421
|
-
readJson(metadataPath(value.current), { version: 0, byRevision: {} }),
|
|
1422
|
-
value.feedback.pins
|
|
1423
|
-
);
|
|
1424
|
-
const revision = revisionOf2(pin);
|
|
1425
|
-
const scoped = local.byRevision?.[revision] ?? { categories: {}, dispositions: {} };
|
|
1426
|
-
const valueForRevision = { ...scoped };
|
|
1427
|
-
if (input.action === "category")
|
|
1428
|
-
valueForRevision.categories = { ...scoped.categories, [pin.id]: input.category };
|
|
1429
|
-
else
|
|
1430
|
-
valueForRevision.dispositions = {
|
|
1431
|
-
...scoped.dispositions,
|
|
1432
|
-
[pin.id]: {
|
|
1433
|
-
disposition: input.disposition,
|
|
1434
|
-
reason: input.reason ?? "",
|
|
1435
|
-
updatedAt,
|
|
1436
|
-
author: "Design owner"
|
|
1437
|
-
}
|
|
1438
|
-
};
|
|
1439
|
-
const next = {
|
|
1440
|
-
version: value.metadata.version + 1,
|
|
1441
|
-
byRevision: { ...local.byRevision, [revision]: valueForRevision }
|
|
1442
|
-
};
|
|
1443
|
-
atomicJson(metadataPath(value.current), next);
|
|
1444
|
-
if (pin.revisionId)
|
|
1445
|
-
outgoing = {
|
|
1446
|
-
revisionId: pin.revisionId,
|
|
1447
|
-
payload: {
|
|
1448
|
-
schemaVersion: input.category === "change-request" ? "1.1.0" : "1.0.0",
|
|
1449
|
-
kind: input.action,
|
|
1450
|
-
author: "Design owner",
|
|
1451
|
-
reviewOf: pin.reviewOf,
|
|
1452
|
-
pinId: pin.id,
|
|
1453
|
-
[input.action]: input[input.action],
|
|
1454
|
-
...input.action === "disposition" ? { reason: input.reason ?? "" } : {},
|
|
1455
|
-
updatedAt
|
|
1456
|
-
}
|
|
1457
|
-
};
|
|
1458
|
-
return;
|
|
1459
|
-
}
|
|
1460
|
-
const path = join3(dirname2(designSpecPath(value.current.root)), "review-handoff.json");
|
|
1461
|
-
const previous = readJson(path, null);
|
|
1462
|
-
if (previous) assertDraft(previous);
|
|
1463
|
-
if (input.version !== (previous?.version ?? 0))
|
|
1464
|
-
throw conflict("The handoff changed in another window. Reload before saving.");
|
|
1465
|
-
let shareUrl;
|
|
1466
|
-
try {
|
|
1467
|
-
shareUrl = getDesignShareStatus(file, { env, ...shareOptions }).url;
|
|
1468
|
-
} catch {
|
|
1469
|
-
}
|
|
1470
|
-
if (input.action === "approve") {
|
|
1471
|
-
if (!previous || input.contentHash !== previous.contentHash || reviewDigest(previous.basis) !== reviewDigest(value.basis))
|
|
1472
|
-
throw conflict(
|
|
1473
|
-
"The handoff is out of date. Rebuild and review the current draft before approving."
|
|
1474
|
-
);
|
|
1475
|
-
if (!canApproveDesignHandoffResolution(value.resolution)) {
|
|
1476
|
-
const diagnostic = value.resolution.diagnostics[0];
|
|
1477
|
-
throw conflict(
|
|
1478
|
-
diagnostic?.message ?? "Resolve the blocking review decisions before approving this handoff."
|
|
1479
|
-
);
|
|
1480
|
-
}
|
|
1481
|
-
if (!previous.content.summary.trim())
|
|
1482
|
-
throw new Error("Write or refine the handoff summary before approving it.");
|
|
1483
|
-
const approved = {
|
|
1484
|
-
...previous,
|
|
1485
|
-
version: previous.version + 1,
|
|
1486
|
-
status: "approved",
|
|
1487
|
-
approval: { contentHash: previous.contentHash, at: (/* @__PURE__ */ new Date()).toISOString() }
|
|
1488
|
-
};
|
|
1489
|
-
approved.markdown = renderMarkdown(approved, value.current.document.title);
|
|
1490
|
-
assertReviewExperience(approved, DESIGN_HANDOFF_SCHEMA);
|
|
1491
|
-
const archive = join3(
|
|
1492
|
-
value.current.root,
|
|
1493
|
-
".design/handoff-approvals",
|
|
1494
|
-
`${approved.contentHash}.json`
|
|
1495
|
-
);
|
|
1496
|
-
if (!existsSync2(archive)) atomicJson(archive, approved);
|
|
1497
|
-
atomicJson(path, approved);
|
|
1498
|
-
writeFileSync(path.replace(/\.json$/u, ".md"), approved.markdown);
|
|
1499
|
-
return;
|
|
1500
|
-
}
|
|
1501
|
-
const content = input.action === "draft" ? contentFromFeedback(value, shareUrl) : enrichContent(input.content, value, shareUrl);
|
|
1502
|
-
if (input.action === "update" && (!previous || reviewDigest(previous.basis) !== reviewDigest(value.basis)))
|
|
1503
|
-
throw conflict("The review changed. Rebuild the draft before refining it.");
|
|
1504
|
-
const affectedScreens = [
|
|
1505
|
-
...new Set(
|
|
1506
|
-
sections.flatMap((key) => content[key].map((item) => item.screenId).filter(Boolean))
|
|
1507
|
-
)
|
|
1508
|
-
];
|
|
1509
|
-
const verificationGaps = value.current.verification.status === "verified" ? [] : [`Rendered design verification: ${value.current.verification.status}.`];
|
|
1510
|
-
for (const issue2 of value.current.verification.issues ?? [])
|
|
1511
|
-
if (issue2.message && verificationGaps.length < 256) verificationGaps.push(issue2.message);
|
|
1512
|
-
const reviewNotes = (value.feedback.ledger?.reviews ?? []).filter((entry) => entry.review.overall?.trim()).map((entry) => ({ reviewId: entry.review.reviewId, text: entry.review.overall }));
|
|
1513
|
-
const title2 = value.current.document.title;
|
|
1514
|
-
const draft = {
|
|
1515
|
-
title: title2,
|
|
1516
|
-
reviewNotes,
|
|
1517
|
-
kind: "openplanr-design-review-handoff",
|
|
1518
|
-
schemaVersion: "1.0.0",
|
|
1519
|
-
version: (previous?.version ?? 0) + 1,
|
|
1520
|
-
status: "draft",
|
|
1521
|
-
basis: value.basis,
|
|
1522
|
-
content,
|
|
1523
|
-
affectedScreens,
|
|
1524
|
-
verificationGaps,
|
|
1525
|
-
contentHash: reviewDigest({
|
|
1526
|
-
title: title2,
|
|
1527
|
-
reviewNotes,
|
|
1528
|
-
basis: value.basis,
|
|
1529
|
-
content,
|
|
1530
|
-
affectedScreens,
|
|
1531
|
-
verificationGaps
|
|
1532
|
-
}),
|
|
1533
|
-
markdown: ""
|
|
1534
|
-
};
|
|
1535
|
-
draft.markdown = renderMarkdown(draft, value.current.document.title);
|
|
1536
|
-
assertReviewExperience(draft, DESIGN_HANDOFF_SCHEMA);
|
|
1537
|
-
atomicJson(path, draft);
|
|
1538
|
-
writeFileSync(path.replace(/\.json$/u, ".md"), draft.markdown);
|
|
1539
|
-
});
|
|
1540
|
-
} finally {
|
|
1541
|
-
unlock();
|
|
1542
|
-
}
|
|
1543
|
-
} finally {
|
|
1544
|
-
unlockRender();
|
|
1545
|
-
}
|
|
1546
|
-
let synchronization;
|
|
1547
|
-
if (outgoing) {
|
|
1548
|
-
try {
|
|
1549
|
-
synchronization = await publishDesignReviewMetadata(file, outgoing.payload, {
|
|
1550
|
-
revisionId: outgoing.revisionId,
|
|
1551
|
-
env,
|
|
1552
|
-
fetchImpl,
|
|
1553
|
-
...shareOptions
|
|
1554
|
-
});
|
|
1555
|
-
} catch (error) {
|
|
1556
|
-
synchronization = { pending: true, error: error.message };
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
return {
|
|
1560
|
-
...readDesignHandoff(file, { env, ...shareOptions }),
|
|
1561
|
-
...synchronization ? { synchronization } : {}
|
|
1562
|
-
};
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
export {
|
|
1566
|
-
designReviewKey,
|
|
1567
|
-
designReviewPath,
|
|
1568
|
-
readDesignFeedback,
|
|
1569
|
-
isDesignHandoffRelativePath,
|
|
1570
|
-
designImplementationHandoffDigest,
|
|
1571
|
-
assertDesignImplementationHandoff,
|
|
1572
|
-
readDesignExperience,
|
|
1573
|
-
readDesignHandoff,
|
|
1574
|
-
readDesignHandoffReadiness,
|
|
1575
|
-
updateDesignHandoff
|
|
1576
|
-
};
|