openplanr 3.2.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -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/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/cli/commands/spec.d.ts +2 -1
- package/dist/cli/commands/spec.d.ts.map +1 -1
- package/dist/cli/commands/spec.js +45 -5
- package/dist/cli/commands/spec.js.map +1 -1
- package/dist/dashboard/.vite/manifest.json +2 -2
- package/dist/dashboard/assets/index-Cv4Vwhuw.css +2 -0
- package/dist/dashboard/assets/index-CvQAlBy3.js +75 -0
- package/dist/dashboard/assets/index-CvQAlBy3.js.map +1 -0
- package/dist/dashboard/dashboard-manifest.json +14 -14
- package/dist/dashboard/index.html +2 -2
- package/dist/services/claude-plugin-service.d.ts +5 -0
- package/dist/services/claude-plugin-service.d.ts.map +1 -1
- package/dist/services/claude-plugin-service.js +18 -2
- package/dist/services/claude-plugin-service.js.map +1 -1
- package/dist/services/codex-plugin-service.d.ts.map +1 -1
- package/dist/services/codex-plugin-service.js +11 -3
- package/dist/services/codex-plugin-service.js.map +1 -1
- package/dist/services/design-artifact-service.d.ts +20 -1
- package/dist/services/design-artifact-service.d.ts.map +1 -1
- package/dist/services/design-artifact-service.js +137 -18
- package/dist/services/design-artifact-service.js.map +1 -1
- package/dist/services/runtime-manager/codex-discovery.d.ts +1 -3
- package/dist/services/runtime-manager/codex-discovery.d.ts.map +1 -1
- package/dist/services/runtime-manager/codex-discovery.js +3 -16
- package/dist/services/runtime-manager/codex-discovery.js.map +1 -1
- package/dist/services/runtime-manager/doctor.d.ts +25 -0
- package/dist/services/runtime-manager/doctor.d.ts.map +1 -1
- package/dist/services/runtime-manager/doctor.js +480 -0
- package/dist/services/runtime-manager/doctor.js.map +1 -1
- package/dist/services/runtime-manager/errors.d.ts +12 -0
- package/dist/services/runtime-manager/errors.d.ts.map +1 -0
- package/dist/services/runtime-manager/errors.js +14 -0
- package/dist/services/runtime-manager/errors.js.map +1 -0
- package/dist/services/runtime-manager/global-state.d.ts +7 -0
- package/dist/services/runtime-manager/global-state.d.ts.map +1 -1
- package/dist/services/runtime-manager/global-state.js +116 -0
- package/dist/services/runtime-manager/global-state.js.map +1 -1
- package/dist/services/runtime-manager/host-version-probe.d.ts +8 -0
- package/dist/services/runtime-manager/host-version-probe.d.ts.map +1 -0
- package/dist/services/runtime-manager/host-version-probe.js +14 -0
- package/dist/services/runtime-manager/host-version-probe.js.map +1 -0
- package/dist/services/runtime-manager/install-plan.d.ts +25 -0
- package/dist/services/runtime-manager/install-plan.d.ts.map +1 -1
- package/dist/services/runtime-manager/install-plan.js +305 -0
- package/dist/services/runtime-manager/install-plan.js.map +1 -1
- package/dist/services/runtime-manager/inventory.d.ts +6 -0
- package/dist/services/runtime-manager/inventory.d.ts.map +1 -1
- package/dist/services/runtime-manager/inventory.js +16 -1
- package/dist/services/runtime-manager/inventory.js.map +1 -1
- package/dist/services/runtime-manager/legacy-adapters.d.ts +9 -0
- package/dist/services/runtime-manager/legacy-adapters.d.ts.map +1 -0
- package/dist/services/runtime-manager/legacy-adapters.js +187 -0
- package/dist/services/runtime-manager/legacy-adapters.js.map +1 -0
- package/dist/services/runtime-manager/paths.d.ts +18 -0
- package/dist/services/runtime-manager/paths.d.ts.map +1 -0
- package/dist/services/runtime-manager/paths.js +83 -0
- package/dist/services/runtime-manager/paths.js.map +1 -0
- package/dist/services/runtime-manager/runtime-package.d.ts +21 -0
- package/dist/services/runtime-manager/runtime-package.d.ts.map +1 -1
- package/dist/services/runtime-manager/runtime-package.js +77 -0
- package/dist/services/runtime-manager/runtime-package.js.map +1 -1
- package/dist/services/runtime-manager/storage.d.ts +47 -0
- package/dist/services/runtime-manager/storage.d.ts.map +1 -0
- package/dist/services/runtime-manager/storage.js +604 -0
- package/dist/services/runtime-manager/storage.js.map +1 -0
- package/dist/services/runtime-manager-service.d.ts +7 -17
- package/dist/services/runtime-manager-service.d.ts.map +1 -1
- package/dist/services/runtime-manager-service.js +32 -1695
- package/dist/services/runtime-manager-service.js.map +1 -1
- package/dist/services/ship-checks/contract.d.ts +15 -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/coverage.d.ts +4 -0
- package/dist/services/ship-checks/coverage.d.ts.map +1 -0
- package/dist/services/ship-checks/coverage.js +113 -0
- package/dist/services/ship-checks/coverage.js.map +1 -0
- package/dist/services/ship-checks/discover.d.ts.map +1 -1
- package/dist/services/ship-checks/discover.js +5 -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/services/spec-service.d.ts +18 -0
- package/dist/services/spec-service.d.ts.map +1 -1
- package/dist/services/spec-service.js +174 -9
- package/dist/services/spec-service.js.map +1 -1
- package/dist/templates/spec/spec-shaped.md.hbs +1 -1
- package/dist/templates/spec/spec.md.hbs +2 -2
- package/dist/utils/splice-managed-block.js +1 -1
- package/dist/utils/splice-managed-block.js.map +1 -1
- package/docs/CLI.md +86 -2
- package/lib/host-packages/adapter-registry.json +5 -5
- package/lib/host-packages/capability-map.json +3 -3
- 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 +94 -146
- package/lib/host-packages/claude/openplanr/README.md +12 -12
- package/lib/host-packages/claude/openplanr/agents/planr-qa.md +5 -3
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/shared/task-context-resolution.md +4 -4
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-artifact-shell.mjs +2 -4
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-document.mjs +110 -25
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-handoff.mjs +851 -57
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review-state-store.mjs +45 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +65 -74
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -1
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +321 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +1652 -0
- package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs → claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs} +537 -5
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +137 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design.mjs +374 -61
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +32 -59
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +138 -133
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +1 -5608
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +2568 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +10 -74
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +4 -4
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +8 -2
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +2 -2
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +5 -5
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +72 -2
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +14 -7
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +71 -34
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +28 -14
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +12 -12
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +6 -2
- package/lib/host-packages/{openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.20.0 → claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0}/design-document.schema.json +131 -4
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +822 -0
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +616 -4775
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +219 -424
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +6 -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/references/design-system.md +17 -2
- package/lib/host-packages/claude/openplanr/skills/design/references/generation.md +60 -2
- package/lib/host-packages/claude/openplanr/skills/design/references/utilities.md +23 -7
- package/lib/host-packages/claude/openplanr/skills/design/schemas/design-document.schema.json +131 -4
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/design-system.md +17 -2
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/generation.md +60 -2
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/utilities.md +23 -7
- package/lib/host-packages/claude/openplanr/skills/design-loop/schemas/design-document.schema.json +131 -4
- package/lib/host-packages/claude/openplanr/skills/design-review/references/design-system.md +17 -2
- package/lib/host-packages/claude/openplanr/skills/design-review/references/generation.md +60 -2
- package/lib/host-packages/claude/openplanr/skills/design-review/references/utilities.md +23 -7
- package/lib/host-packages/claude/openplanr/skills/design-review/schemas/design-document.schema.json +131 -4
- package/lib/host-packages/claude/openplanr/skills/investigate/SKILL.md +2 -1
- package/lib/host-packages/claude/openplanr/skills/investigate/references/fail-first.md +40 -0
- package/lib/host-packages/claude/openplanr/skills/plan/SKILL.md +21 -11
- package/lib/host-packages/claude/openplanr/skills/plan/schemas/design-document.schema.json +131 -4
- package/lib/host-packages/claude/openplanr/skills/ship/SKILL.md +51 -18
- 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/claude/openplanr/skills/spec/SKILL.md +6 -0
- package/lib/host-packages/claude/openplanr/skills/spec/references/specification-contract.md +3 -1
- package/lib/host-packages/cursor/openplanr/.openplanr-content.json +91 -143
- package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
- 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 +17 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/generation.md +60 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/utilities.md +23 -7
- package/lib/host-packages/cursor/openplanr/rules/planr-design/schemas/design-document.schema.json +131 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/design-system.md +17 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/generation.md +60 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/utilities.md +23 -7
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/schemas/design-document.schema.json +131 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/design-system.md +17 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/generation.md +60 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/utilities.md +23 -7
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/schemas/design-document.schema.json +131 -4
- 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 +2 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-plan/schemas/design-document.schema.json +131 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-plan.mdc +21 -11
- 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 +51 -18
- package/lib/host-packages/cursor/openplanr/rules/planr-spec/references/specification-contract.md +3 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-spec.mdc +6 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-artifact-shell.mjs +2 -4
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-document.mjs +110 -25
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-handoff.mjs +851 -57
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review-state-store.mjs +45 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +65 -74
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -1
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +321 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +1652 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/{design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs → design-shared-artifact-support-protocol-contracts-9f6918b0.mjs} +537 -5
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +137 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design.mjs +374 -61
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +32 -59
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +138 -133
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +1 -5608
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +2568 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +10 -74
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +4 -4
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +8 -2
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +2 -2
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +5 -5
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +72 -2
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +14 -7
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +71 -34
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +28 -14
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +12 -12
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +6 -2
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/{v1.20.0 → v1.22.0}/design-document.schema.json +131 -4
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +822 -0
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +616 -4775
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +219 -424
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +6 -2
- 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 +98 -150
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-artifact-shell.mjs +2 -4
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-document.mjs +110 -25
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-handoff.mjs +851 -57
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review-state-store.mjs +45 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +65 -74
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -1
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +321 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +1652 -0
- package/lib/host-packages/{claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs → openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs} +537 -5
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +137 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design.mjs +374 -61
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +32 -59
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +138 -133
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +1 -5608
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +2568 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +10 -74
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +4 -4
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +8 -2
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +2 -2
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +5 -5
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +72 -2
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +14 -7
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +71 -34
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +28 -14
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +12 -12
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +6 -2
- package/lib/host-packages/{claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.20.0 → openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0}/design-document.schema.json +131 -4
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +822 -0
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +616 -4775
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +219 -424
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +6 -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/references/design-system.md +17 -2
- package/lib/host-packages/openai/openplanr/skills/design/references/generation.md +60 -2
- package/lib/host-packages/openai/openplanr/skills/design/references/utilities.md +23 -7
- package/lib/host-packages/openai/openplanr/skills/design/schemas/design-document.schema.json +131 -4
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/design-system.md +17 -2
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/generation.md +60 -2
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/utilities.md +23 -7
- package/lib/host-packages/openai/openplanr/skills/design-loop/schemas/design-document.schema.json +131 -4
- package/lib/host-packages/openai/openplanr/skills/design-review/references/design-system.md +17 -2
- package/lib/host-packages/openai/openplanr/skills/design-review/references/generation.md +60 -2
- package/lib/host-packages/openai/openplanr/skills/design-review/references/utilities.md +23 -7
- package/lib/host-packages/openai/openplanr/skills/design-review/schemas/design-document.schema.json +131 -4
- package/lib/host-packages/openai/openplanr/skills/investigate/SKILL.md +2 -1
- package/lib/host-packages/openai/openplanr/skills/investigate/agents/openai.yaml +1 -1
- 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 +21 -11
- package/lib/host-packages/openai/openplanr/skills/plan/openplanr.skill.json +1 -1
- package/lib/host-packages/openai/openplanr/skills/plan/schemas/design-document.schema.json +131 -4
- package/lib/host-packages/openai/openplanr/skills/ship/SKILL.md +51 -18
- package/lib/host-packages/openai/openplanr/skills/ship/agents/openai.yaml +1 -1
- 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/lib/host-packages/openai/openplanr/skills/spec/SKILL.md +6 -0
- package/lib/host-packages/openai/openplanr/skills/spec/openplanr.skill.json +1 -1
- package/lib/host-packages/openai/openplanr/skills/spec/references/specification-contract.md +3 -1
- package/lib/json-schema.mjs +4 -0
- package/package.json +16 -16
- package/dist/dashboard/assets/index-BU5fzjyz.css +0 -1
- package/dist/dashboard/assets/index-L8qtwqv6.js +0 -572
- package/dist/dashboard/assets/index-L8qtwqv6.js.map +0 -1
- 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-encrypted-workspace-client.mjs +0 -647
- 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-resource-pack.mjs +0 -698
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-support-6774fd3d5d02.mjs +0 -24
- 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 -1020
- 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 -5778
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
- 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/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.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/skills/delegate/scripts/integration-transaction.mjs +0 -958
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/integration-transaction.mjs +0 -958
- 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-encrypted-workspace-client.mjs +0 -647
- 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-resource-pack.mjs +0 -698
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-support-6774fd3d5d02.mjs +0 -24
- 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 -1020
- 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 -5778
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
- 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/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.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/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-encrypted-workspace-client.mjs +0 -647
- 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-resource-pack.mjs +0 -698
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-support-6774fd3d5d02.mjs +0 -24
- 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 -1020
- 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 -5778
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-upload-spool.mjs +0 -198
- 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/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.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/skills/delegate/scripts/integration-transaction.mjs +0 -958
|
@@ -1,1020 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isProcessAlive
|
|
3
|
-
} from "./design-loopback-server.mjs";
|
|
4
|
-
import {
|
|
5
|
-
Parser,
|
|
6
|
-
defaultTreeAdapter
|
|
7
|
-
} from "./design-parse5-parser.mjs";
|
|
8
|
-
import {
|
|
9
|
-
NS,
|
|
10
|
-
TAG_NAMES,
|
|
11
|
-
hasUnescapedText
|
|
12
|
-
} from "./design-parse5-tokenizer.mjs";
|
|
13
|
-
import {
|
|
14
|
-
MAX_ARTIFACT_HTML_BYTES
|
|
15
|
-
} from "./design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs";
|
|
16
|
-
import {
|
|
17
|
-
DESIGN_DOCUMENT_SCHEMA,
|
|
18
|
-
DESIGN_REVIEW_BUNDLE_SCHEMA,
|
|
19
|
-
validateJson
|
|
20
|
-
} from "./design-shared-protocol-contracts-b5f28f94.mjs";
|
|
21
|
-
import {
|
|
22
|
-
canonicalizeJson,
|
|
23
|
-
sha256Hex
|
|
24
|
-
} from "./design-shared-protocol-contracts-75a938cc.mjs";
|
|
25
|
-
|
|
26
|
-
// packages/design/lib/design/document-state.mjs
|
|
27
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
28
|
-
import {
|
|
29
|
-
chmodSync,
|
|
30
|
-
closeSync,
|
|
31
|
-
lstatSync,
|
|
32
|
-
mkdirSync,
|
|
33
|
-
openSync,
|
|
34
|
-
readFileSync,
|
|
35
|
-
realpathSync,
|
|
36
|
-
renameSync,
|
|
37
|
-
rmSync,
|
|
38
|
-
writeFileSync
|
|
39
|
-
} from "node:fs";
|
|
40
|
-
import { dirname, join, resolve } from "node:path";
|
|
41
|
-
var hash = (value) => createHash("sha256").update(value).digest("hex");
|
|
42
|
-
var json = (value) => `${JSON.stringify(value, null, 2)}
|
|
43
|
-
`;
|
|
44
|
-
function readJson(path, fallback = void 0) {
|
|
45
|
-
try {
|
|
46
|
-
return JSON.parse(readFileSync(path, "utf8"));
|
|
47
|
-
} catch (error) {
|
|
48
|
-
if (error.code === "ENOENT" && fallback !== void 0) return fallback;
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function atomicJson(path, value, { mode } = {}) {
|
|
53
|
-
atomicBytes(path, json(value), mode);
|
|
54
|
-
}
|
|
55
|
-
function atomicBytes(path, bytes, mode) {
|
|
56
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
57
|
-
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
58
|
-
try {
|
|
59
|
-
writeFileSync(temporary, bytes, { mode: 384, flag: "wx" });
|
|
60
|
-
if (mode !== void 0) chmodSync(temporary, mode);
|
|
61
|
-
renameSync(temporary, path);
|
|
62
|
-
} finally {
|
|
63
|
-
rmSync(temporary, { force: true });
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function recoverDesignPublication(root, { ownsRenderLock = false } = {}) {
|
|
67
|
-
const journalPath = join(root, ".design/publication.json");
|
|
68
|
-
let journal = readJson(journalPath, null);
|
|
69
|
-
if (!journal) return;
|
|
70
|
-
const lockPath = join(root, ".design/render.lock");
|
|
71
|
-
let recoveryOwner;
|
|
72
|
-
if (!ownsRenderLock) {
|
|
73
|
-
const lock = readJson(lockPath, null);
|
|
74
|
-
if (lock && isProcessAlive(lock.pid)) return;
|
|
75
|
-
if (lock) rmSync(lockPath, { force: true });
|
|
76
|
-
recoveryOwner = randomUUID();
|
|
77
|
-
let descriptor;
|
|
78
|
-
try {
|
|
79
|
-
descriptor = openSync(lockPath, "wx", 384);
|
|
80
|
-
writeFileSync(
|
|
81
|
-
descriptor,
|
|
82
|
-
json({ pid: process.pid, owner: recoveryOwner, createdAt: Date.now() })
|
|
83
|
-
);
|
|
84
|
-
} catch (error) {
|
|
85
|
-
if (error.code === "EEXIST") return;
|
|
86
|
-
throw error;
|
|
87
|
-
} finally {
|
|
88
|
-
if (descriptor !== void 0) closeSync(descriptor);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
try {
|
|
92
|
-
journal = readJson(journalPath, null);
|
|
93
|
-
if (!journal) return;
|
|
94
|
-
const pointer = readJson(join(root, ".design/current.json"), null);
|
|
95
|
-
const manifestPath = join(root, "finalized.json");
|
|
96
|
-
if (pointer?.revision === journal.revision) atomicJson(manifestPath, journal.manifest);
|
|
97
|
-
else if ((pointer?.revision ?? null) === journal.previousRevision) {
|
|
98
|
-
if (journal.previousManifest === null) rmSync(manifestPath, { force: true });
|
|
99
|
-
else atomicBytes(manifestPath, Buffer.from(journal.previousManifest, "base64"));
|
|
100
|
-
} else if (pointer?.revision && /^[a-f0-9]{64}$/u.test(pointer.revision)) {
|
|
101
|
-
atomicJson(
|
|
102
|
-
manifestPath,
|
|
103
|
-
readJson(join(root, ".design/revisions", pointer.revision, "render.json")).manifest
|
|
104
|
-
);
|
|
105
|
-
} else
|
|
106
|
-
throw new Error("Design publication recovery could not identify the committed revision.");
|
|
107
|
-
rmSync(journalPath, { force: true });
|
|
108
|
-
} finally {
|
|
109
|
-
if (recoveryOwner && readJson(lockPath, null)?.owner === recoveryOwner)
|
|
110
|
-
rmSync(lockPath, { force: true });
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function designSpecPath(root) {
|
|
114
|
-
return /(?:^|\/)output\/feats\/feat-[^/]+\/design$/u.test(root.replaceAll("\\", "/")) ? join(dirname(root), "design-spec.md") : join(root, "design-spec.md");
|
|
115
|
-
}
|
|
116
|
-
function currentDesign(file, { recoverPublication = true } = {}) {
|
|
117
|
-
const root = realpathSync(dirname(resolve(file)));
|
|
118
|
-
if (recoverPublication) recoverDesignPublication(root);
|
|
119
|
-
else {
|
|
120
|
-
try {
|
|
121
|
-
lstatSync(join(root, ".design/publication.json"));
|
|
122
|
-
throw Object.assign(
|
|
123
|
-
new Error(
|
|
124
|
-
"Design publication state is pending or needs recovery. Finish or recover it with the Design utility; repair or restore an invalid .design/publication.json before retrying Plan handoff inspection."
|
|
125
|
-
),
|
|
126
|
-
{ code: "E_DESIGN_PUBLICATION_PENDING", statusCode: 409 }
|
|
127
|
-
);
|
|
128
|
-
} catch (error) {
|
|
129
|
-
if (error.code !== "ENOENT") throw error;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
const pointer = readJson(join(root, ".design/current.json"), null);
|
|
133
|
-
if (!pointer || !/^[a-f0-9]{64}$/u.test(pointer.revision))
|
|
134
|
-
throw new Error("Design has no completed render. Run the render utility first.");
|
|
135
|
-
const directory = join(root, ".design/revisions", pointer.revision);
|
|
136
|
-
const prepared = readJson(join(directory, "render.json"));
|
|
137
|
-
return {
|
|
138
|
-
...prepared,
|
|
139
|
-
root,
|
|
140
|
-
directory,
|
|
141
|
-
file: resolve(file),
|
|
142
|
-
verification: readJson(join(root, ".design/verification", `${pointer.revision}.json`), {
|
|
143
|
-
status: "unverified",
|
|
144
|
-
revision: pointer.revision
|
|
145
|
-
})
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// packages/artifact/lib/artifact/local-document.mjs
|
|
150
|
-
import { createHash as createHash2 } from "node:crypto";
|
|
151
|
-
import { readFileSync as readFileSync2, realpathSync as realpathSync2, statSync } from "node:fs";
|
|
152
|
-
import { dirname as dirname2, extname, isAbsolute, relative, resolve as resolve2 } from "node:path";
|
|
153
|
-
import { Script } from "node:vm";
|
|
154
|
-
|
|
155
|
-
// node_modules/entities/dist/escape.js
|
|
156
|
-
var getCodePoint = typeof String.prototype.codePointAt === "function" ? (input, index) => input.codePointAt(index) : (
|
|
157
|
-
// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
|
158
|
-
(c, index) => (c.charCodeAt(index) & 64512) === 55296 ? (c.charCodeAt(index) - 55296) * 1024 + c.charCodeAt(index + 1) - 56320 + 65536 : c.charCodeAt(index)
|
|
159
|
-
);
|
|
160
|
-
function getEscaper(regex, map) {
|
|
161
|
-
return function escape(data) {
|
|
162
|
-
let match;
|
|
163
|
-
let lastIndex = 0;
|
|
164
|
-
let result = "";
|
|
165
|
-
while (match = regex.exec(data)) {
|
|
166
|
-
if (lastIndex !== match.index) {
|
|
167
|
-
result += data.substring(lastIndex, match.index);
|
|
168
|
-
}
|
|
169
|
-
result += map.get(match[0].charCodeAt(0));
|
|
170
|
-
lastIndex = match.index + 1;
|
|
171
|
-
}
|
|
172
|
-
return result + data.substring(lastIndex);
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
var escapeAttribute = /* @__PURE__ */ getEscaper(/["&\u00A0]/g, /* @__PURE__ */ new Map([
|
|
176
|
-
[34, """],
|
|
177
|
-
[38, "&"],
|
|
178
|
-
[160, " "]
|
|
179
|
-
]));
|
|
180
|
-
var escapeText = /* @__PURE__ */ getEscaper(/[&<>\u00A0]/g, /* @__PURE__ */ new Map([
|
|
181
|
-
[38, "&"],
|
|
182
|
-
[60, "<"],
|
|
183
|
-
[62, ">"],
|
|
184
|
-
[160, " "]
|
|
185
|
-
]));
|
|
186
|
-
|
|
187
|
-
// node_modules/parse5/dist/serializer/index.js
|
|
188
|
-
var VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
189
|
-
TAG_NAMES.AREA,
|
|
190
|
-
TAG_NAMES.BASE,
|
|
191
|
-
TAG_NAMES.BASEFONT,
|
|
192
|
-
TAG_NAMES.BGSOUND,
|
|
193
|
-
TAG_NAMES.BR,
|
|
194
|
-
TAG_NAMES.COL,
|
|
195
|
-
TAG_NAMES.EMBED,
|
|
196
|
-
TAG_NAMES.FRAME,
|
|
197
|
-
TAG_NAMES.HR,
|
|
198
|
-
TAG_NAMES.IMG,
|
|
199
|
-
TAG_NAMES.INPUT,
|
|
200
|
-
TAG_NAMES.KEYGEN,
|
|
201
|
-
TAG_NAMES.LINK,
|
|
202
|
-
TAG_NAMES.META,
|
|
203
|
-
TAG_NAMES.PARAM,
|
|
204
|
-
TAG_NAMES.SOURCE,
|
|
205
|
-
TAG_NAMES.TRACK,
|
|
206
|
-
TAG_NAMES.WBR
|
|
207
|
-
]);
|
|
208
|
-
function isVoidElement(node, options) {
|
|
209
|
-
return options.treeAdapter.isElementNode(node) && options.treeAdapter.getNamespaceURI(node) === NS.HTML && VOID_ELEMENTS.has(options.treeAdapter.getTagName(node));
|
|
210
|
-
}
|
|
211
|
-
var defaultOpts = { treeAdapter: defaultTreeAdapter, scriptingEnabled: true };
|
|
212
|
-
function serialize(node, options) {
|
|
213
|
-
const opts = { ...defaultOpts, ...options };
|
|
214
|
-
if (isVoidElement(node, opts)) {
|
|
215
|
-
return "";
|
|
216
|
-
}
|
|
217
|
-
return serializeChildNodes(node, opts);
|
|
218
|
-
}
|
|
219
|
-
function serializeChildNodes(parentNode, options) {
|
|
220
|
-
let html = "";
|
|
221
|
-
const container = options.treeAdapter.isElementNode(parentNode) && options.treeAdapter.getTagName(parentNode) === TAG_NAMES.TEMPLATE && options.treeAdapter.getNamespaceURI(parentNode) === NS.HTML ? options.treeAdapter.getTemplateContent(parentNode) : parentNode;
|
|
222
|
-
const childNodes = options.treeAdapter.getChildNodes(container);
|
|
223
|
-
if (childNodes) {
|
|
224
|
-
for (const currentNode of childNodes) {
|
|
225
|
-
html += serializeNode(currentNode, options);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return html;
|
|
229
|
-
}
|
|
230
|
-
function serializeNode(node, options) {
|
|
231
|
-
if (options.treeAdapter.isElementNode(node)) {
|
|
232
|
-
return serializeElement(node, options);
|
|
233
|
-
}
|
|
234
|
-
if (options.treeAdapter.isTextNode(node)) {
|
|
235
|
-
return serializeTextNode(node, options);
|
|
236
|
-
}
|
|
237
|
-
if (options.treeAdapter.isCommentNode(node)) {
|
|
238
|
-
return serializeCommentNode(node, options);
|
|
239
|
-
}
|
|
240
|
-
if (options.treeAdapter.isDocumentTypeNode(node)) {
|
|
241
|
-
return serializeDocumentTypeNode(node, options);
|
|
242
|
-
}
|
|
243
|
-
return "";
|
|
244
|
-
}
|
|
245
|
-
function serializeElement(node, options) {
|
|
246
|
-
const tn = options.treeAdapter.getTagName(node);
|
|
247
|
-
return `<${tn}${serializeAttributes(node, options)}>${isVoidElement(node, options) ? "" : `${serializeChildNodes(node, options)}</${tn}>`}`;
|
|
248
|
-
}
|
|
249
|
-
function serializeAttributes(node, { treeAdapter }) {
|
|
250
|
-
let html = "";
|
|
251
|
-
for (const attr2 of treeAdapter.getAttrList(node)) {
|
|
252
|
-
html += " ";
|
|
253
|
-
if (attr2.namespace) {
|
|
254
|
-
switch (attr2.namespace) {
|
|
255
|
-
case NS.XML: {
|
|
256
|
-
html += `xml:${attr2.name}`;
|
|
257
|
-
break;
|
|
258
|
-
}
|
|
259
|
-
case NS.XMLNS: {
|
|
260
|
-
if (attr2.name !== "xmlns") {
|
|
261
|
-
html += "xmlns:";
|
|
262
|
-
}
|
|
263
|
-
html += attr2.name;
|
|
264
|
-
break;
|
|
265
|
-
}
|
|
266
|
-
case NS.XLINK: {
|
|
267
|
-
html += `xlink:${attr2.name}`;
|
|
268
|
-
break;
|
|
269
|
-
}
|
|
270
|
-
default: {
|
|
271
|
-
html += `${attr2.prefix}:${attr2.name}`;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
} else {
|
|
275
|
-
html += attr2.name;
|
|
276
|
-
}
|
|
277
|
-
html += `="${escapeAttribute(attr2.value)}"`;
|
|
278
|
-
}
|
|
279
|
-
return html;
|
|
280
|
-
}
|
|
281
|
-
function serializeTextNode(node, options) {
|
|
282
|
-
const { treeAdapter } = options;
|
|
283
|
-
const content = treeAdapter.getTextNodeContent(node);
|
|
284
|
-
const parent = treeAdapter.getParentNode(node);
|
|
285
|
-
const parentTn = parent && treeAdapter.isElementNode(parent) && treeAdapter.getTagName(parent);
|
|
286
|
-
return parentTn && treeAdapter.getNamespaceURI(parent) === NS.HTML && hasUnescapedText(parentTn, options.scriptingEnabled) ? content : escapeText(content);
|
|
287
|
-
}
|
|
288
|
-
function serializeCommentNode(node, { treeAdapter }) {
|
|
289
|
-
return `<!--${treeAdapter.getCommentNodeContent(node)}-->`;
|
|
290
|
-
}
|
|
291
|
-
function serializeDocumentTypeNode(node, { treeAdapter }) {
|
|
292
|
-
return `<!DOCTYPE ${treeAdapter.getDocumentTypeNodeName(node)}>`;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// node_modules/parse5/dist/index.js
|
|
296
|
-
function parse(html, options) {
|
|
297
|
-
return Parser.parse(html, options);
|
|
298
|
-
}
|
|
299
|
-
function parseFragment(fragmentContext, html, options) {
|
|
300
|
-
if (typeof fragmentContext === "string") {
|
|
301
|
-
options = html;
|
|
302
|
-
html = fragmentContext;
|
|
303
|
-
fragmentContext = null;
|
|
304
|
-
}
|
|
305
|
-
const parser = Parser.getFragmentParser(fragmentContext, options);
|
|
306
|
-
parser.tokenizer.write(html, true);
|
|
307
|
-
return parser.getFragment();
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// packages/artifact/lib/artifact/local-document.mjs
|
|
311
|
-
var MIME = {
|
|
312
|
-
".png": "image/png",
|
|
313
|
-
".jpg": "image/jpeg",
|
|
314
|
-
".jpeg": "image/jpeg",
|
|
315
|
-
".svg": "image/svg+xml",
|
|
316
|
-
".webp": "image/webp",
|
|
317
|
-
".avif": "image/avif",
|
|
318
|
-
".gif": "image/gif",
|
|
319
|
-
".woff": "font/woff",
|
|
320
|
-
".woff2": "font/woff2",
|
|
321
|
-
".ttf": "font/ttf",
|
|
322
|
-
".ico": "image/x-icon"
|
|
323
|
-
};
|
|
324
|
-
var children = (node) => [...node.childNodes ?? [], ...node.content?.childNodes ?? []];
|
|
325
|
-
var attr = (node, name) => node.attrs?.find((item2) => item2.name === name);
|
|
326
|
-
var text = (node) => children(node).map((item2) => item2.value ?? "").join("");
|
|
327
|
-
function setText(node, value) {
|
|
328
|
-
node.childNodes = [{ nodeName: "#text", value, parentNode: node }];
|
|
329
|
-
}
|
|
330
|
-
function element(name, value) {
|
|
331
|
-
const node = parseFragment(`<${name}></${name}>`).childNodes[0];
|
|
332
|
-
setText(node, value);
|
|
333
|
-
return node;
|
|
334
|
-
}
|
|
335
|
-
function resolveLocalDocumentFile(root, path, from = root) {
|
|
336
|
-
if (typeof path !== "string" || !path || /^(?:[a-z][a-z\d+.-]*:|\/|\\)/iu.test(path))
|
|
337
|
-
throw new Error(`Expected a local relative asset: ${path}`);
|
|
338
|
-
const candidate = resolve2(from, path);
|
|
339
|
-
const inside = (file) => {
|
|
340
|
-
const r = relative(root, file);
|
|
341
|
-
return r !== ".." && !r.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) && !isAbsolute(r);
|
|
342
|
-
};
|
|
343
|
-
if (!inside(candidate)) throw new Error(`Asset escapes design root: ${path}`);
|
|
344
|
-
const actual = realpathSync2(candidate);
|
|
345
|
-
if (!inside(actual) || !statSync(actual).isFile())
|
|
346
|
-
throw new Error(`Asset is not a contained regular file: ${path}`);
|
|
347
|
-
return actual;
|
|
348
|
-
}
|
|
349
|
-
function bundleLocalDocument({
|
|
350
|
-
root: inputRoot,
|
|
351
|
-
source,
|
|
352
|
-
sharedStyles = [],
|
|
353
|
-
screenId,
|
|
354
|
-
maxBytes = MAX_ARTIFACT_HTML_BYTES,
|
|
355
|
-
readSource,
|
|
356
|
-
passive = false
|
|
357
|
-
}) {
|
|
358
|
-
const root = realpathSync2(inputRoot);
|
|
359
|
-
const files = /* @__PURE__ */ new Map();
|
|
360
|
-
const mediaStack = /* @__PURE__ */ new Set();
|
|
361
|
-
let svgDepth = 0;
|
|
362
|
-
let cssExpansionBytes = 0;
|
|
363
|
-
let cssExpansions = 0;
|
|
364
|
-
let bytes = 0;
|
|
365
|
-
function read(path, from = root) {
|
|
366
|
-
const checked = readSource?.(path, from);
|
|
367
|
-
const file = checked?.file ?? resolveLocalDocumentFile(root, path, from);
|
|
368
|
-
if (!files.has(file)) {
|
|
369
|
-
const value = checked?.value ?? readFileSync2(file);
|
|
370
|
-
bytes += value.length;
|
|
371
|
-
if (bytes > maxBytes || files.size >= 1e3)
|
|
372
|
-
throw new Error("Design source exceeds the local asset budget.");
|
|
373
|
-
files.set(file, value);
|
|
374
|
-
}
|
|
375
|
-
return { file, value: files.get(file) };
|
|
376
|
-
}
|
|
377
|
-
function asset(ref, from) {
|
|
378
|
-
if (/^#/iu.test(ref)) return ref;
|
|
379
|
-
if (/^data:/iu.test(ref)) {
|
|
380
|
-
if (!passive) return ref;
|
|
381
|
-
const match = /^data:([^;,]+)(;base64)?,([\s\S]*)$/iu.exec(ref);
|
|
382
|
-
if (!match || !Object.values(MIME).includes(match[1].toLowerCase()))
|
|
383
|
-
throw new Error("Passive design media must be a supported image or font.");
|
|
384
|
-
if (match[1].toLowerCase() !== "image/svg+xml") return ref;
|
|
385
|
-
const svg = match[2] ? Buffer.from(match[3], "base64").toString("utf8") : decodeURIComponent(match[3]);
|
|
386
|
-
return `data:image/svg+xml;base64,${Buffer.from(passiveSvg(svg, from)).toString("base64")}`;
|
|
387
|
-
}
|
|
388
|
-
const fragmentIndex = ref.indexOf("#");
|
|
389
|
-
const fragment = fragmentIndex < 0 ? "" : ref.slice(fragmentIndex);
|
|
390
|
-
const { file, value } = read(fragmentIndex < 0 ? ref : ref.slice(0, fragmentIndex), from);
|
|
391
|
-
if (!MIME[extname(file).toLowerCase()]) throw new Error(`Unsupported local media: ${ref}`);
|
|
392
|
-
let payload = value;
|
|
393
|
-
if (passive && extname(file).toLowerCase() === ".svg") {
|
|
394
|
-
if (mediaStack.has(file) || mediaStack.size >= 16)
|
|
395
|
-
throw new Error("Circular or excessively nested SVG media cannot be published.");
|
|
396
|
-
mediaStack.add(file);
|
|
397
|
-
try {
|
|
398
|
-
payload = Buffer.from(passiveSvg(value.toString("utf8"), dirname2(file)));
|
|
399
|
-
} finally {
|
|
400
|
-
mediaStack.delete(file);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
return `data:${MIME[extname(file).toLowerCase()]};base64,${payload.toString("base64")}${fragment}`;
|
|
404
|
-
}
|
|
405
|
-
function passiveSvg(value, from) {
|
|
406
|
-
if (++svgDepth > 16) throw new Error("Excessively nested SVG media cannot be published.");
|
|
407
|
-
try {
|
|
408
|
-
const fragment = parseFragment(value);
|
|
409
|
-
if (!fragment.childNodes.some((node) => node.tagName === "svg"))
|
|
410
|
-
throw new Error("SVG media must contain an SVG drawing.");
|
|
411
|
-
const queue2 = [...children(fragment)];
|
|
412
|
-
while (queue2.length) {
|
|
413
|
-
const node = queue2.shift();
|
|
414
|
-
if (["script", "foreignObject", "iframe", "object", "embed"].includes(node.tagName)) {
|
|
415
|
-
node.parentNode.childNodes = node.parentNode.childNodes.filter((child) => child !== node);
|
|
416
|
-
continue;
|
|
417
|
-
}
|
|
418
|
-
node.attrs = (node.attrs ?? []).filter((item2) => !/^on/iu.test(item2.name));
|
|
419
|
-
if (node.tagName === "style") setText(node, css(text(node), from));
|
|
420
|
-
for (const item2 of node.attrs) {
|
|
421
|
-
if (item2.name === "style") item2.value = css(item2.value, from);
|
|
422
|
-
if (["href", "src"].includes(item2.name)) item2.value = asset(item2.value, from);
|
|
423
|
-
}
|
|
424
|
-
queue2.unshift(...children(node));
|
|
425
|
-
}
|
|
426
|
-
return serialize(fragment);
|
|
427
|
-
} finally {
|
|
428
|
-
svgDepth--;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
function replaceCss(value, pattern, replacement) {
|
|
432
|
-
const parts = [];
|
|
433
|
-
let offset = 0, outputBytes = 0;
|
|
434
|
-
function append(part) {
|
|
435
|
-
const size = Buffer.byteLength(part);
|
|
436
|
-
outputBytes += size;
|
|
437
|
-
cssExpansionBytes += size;
|
|
438
|
-
if (outputBytes > maxBytes || cssExpansionBytes > maxBytes * 8)
|
|
439
|
-
throw new Error("Stylesheet expansion exceeds the local asset budget.");
|
|
440
|
-
parts.push(part);
|
|
441
|
-
}
|
|
442
|
-
for (const match of value.matchAll(pattern)) {
|
|
443
|
-
append(value.slice(offset, match.index));
|
|
444
|
-
append(replacement(...match));
|
|
445
|
-
offset = match.index + match[0].length;
|
|
446
|
-
}
|
|
447
|
-
append(value.slice(offset));
|
|
448
|
-
return parts.join("");
|
|
449
|
-
}
|
|
450
|
-
function css(value, from, stack = /* @__PURE__ */ new Set()) {
|
|
451
|
-
if (++cssExpansions > 4096)
|
|
452
|
-
throw new Error("Stylesheet expansion complexity exceeds the local asset budget.");
|
|
453
|
-
let result = replaceCss(
|
|
454
|
-
value,
|
|
455
|
-
/@import\s+(?:url\(\s*)?["']([^"']+)["']\s*\)?\s*([^;]*);/giu,
|
|
456
|
-
(_all, ref, media) => {
|
|
457
|
-
const next = read(ref, from);
|
|
458
|
-
if (stack.has(next.file)) throw new Error(`Circular stylesheet import: ${ref}`);
|
|
459
|
-
const expanded = css(
|
|
460
|
-
next.value.toString("utf8"),
|
|
461
|
-
dirname2(next.file),
|
|
462
|
-
/* @__PURE__ */ new Set([...stack, next.file])
|
|
463
|
-
);
|
|
464
|
-
return media.trim() ? `@media ${media.trim()}{${expanded}}` : expanded;
|
|
465
|
-
}
|
|
466
|
-
);
|
|
467
|
-
if (/@import\b/iu.test(result)) throw new Error("Use quoted local stylesheet imports.");
|
|
468
|
-
result = replaceCss(
|
|
469
|
-
result,
|
|
470
|
-
/url\(\s*(["']?)(.*?)\1\s*\)/giu,
|
|
471
|
-
(_all, _quote, ref) => `url("${asset(ref, from)}")`
|
|
472
|
-
);
|
|
473
|
-
return replaceCss(result, /<\/style/giu, () => "<\\/style");
|
|
474
|
-
}
|
|
475
|
-
function js(value, label) {
|
|
476
|
-
try {
|
|
477
|
-
new Script(value, { filename: label });
|
|
478
|
-
} catch (error) {
|
|
479
|
-
throw new Error(
|
|
480
|
-
`Use compiled, self-contained browser JavaScript in ${label}: ${error.message}`
|
|
481
|
-
);
|
|
482
|
-
}
|
|
483
|
-
return value.replace(/<\/script/giu, "<\\/script");
|
|
484
|
-
}
|
|
485
|
-
const input = read(source.html);
|
|
486
|
-
const document = parse(input.value.toString("utf8"));
|
|
487
|
-
let head, body;
|
|
488
|
-
const deferredScripts = [];
|
|
489
|
-
const queue = [...children(document)];
|
|
490
|
-
while (queue.length) {
|
|
491
|
-
const node = queue.shift();
|
|
492
|
-
if (node.tagName === "head") head = node;
|
|
493
|
-
if (node.tagName === "body") body = node;
|
|
494
|
-
if (["base", "iframe", "frame", "frameset", "object", "embed"].includes(node.tagName))
|
|
495
|
-
throw new Error(
|
|
496
|
-
`Unsupported <${node.tagName}> in a local design. Use local controls and button handlers.`
|
|
497
|
-
);
|
|
498
|
-
if (node.tagName === "meta" && attr(node, "http-equiv")?.value.toLowerCase() === "refresh")
|
|
499
|
-
throw new Error("Design screens cannot redirect.");
|
|
500
|
-
if (node.tagName === "style") setText(node, css(text(node), dirname2(input.file)));
|
|
501
|
-
if (node.tagName === "link" && attr(node, "rel")?.value.toLowerCase().split(/\s+/u).includes("stylesheet")) {
|
|
502
|
-
const linked = read(attr(node, "href")?.value, dirname2(input.file));
|
|
503
|
-
node.tagName = "style";
|
|
504
|
-
node.nodeName = "style";
|
|
505
|
-
node.attrs = [];
|
|
506
|
-
setText(
|
|
507
|
-
node,
|
|
508
|
-
css(linked.value.toString("utf8"), dirname2(linked.file), /* @__PURE__ */ new Set([linked.file]))
|
|
509
|
-
);
|
|
510
|
-
}
|
|
511
|
-
if (node.tagName === "script") {
|
|
512
|
-
const src = attr(node, "src");
|
|
513
|
-
if (passive) {
|
|
514
|
-
if (src) read(src.value, dirname2(input.file));
|
|
515
|
-
node.parentNode.childNodes = node.parentNode.childNodes.filter((child) => child !== node);
|
|
516
|
-
continue;
|
|
517
|
-
}
|
|
518
|
-
const type = attr(node, "type")?.value.trim().toLowerCase();
|
|
519
|
-
if (type === "module")
|
|
520
|
-
throw new Error("Compile module scripts before using them in a portable design.");
|
|
521
|
-
if (!type || /(?:javascript|ecmascript)/u.test(type)) {
|
|
522
|
-
const linked = src ? read(src.value, dirname2(input.file)) : null;
|
|
523
|
-
setText(
|
|
524
|
-
node,
|
|
525
|
-
js(linked ? linked.value.toString("utf8") : text(node), linked?.file ?? input.file)
|
|
526
|
-
);
|
|
527
|
-
if (src && attr(node, "defer")) {
|
|
528
|
-
deferredScripts.push(node);
|
|
529
|
-
node.parentNode.childNodes = node.parentNode.childNodes.filter((child) => child !== node);
|
|
530
|
-
}
|
|
531
|
-
node.attrs = (node.attrs ?? []).filter(
|
|
532
|
-
(item2) => !["src", "async", "defer"].includes(item2.name)
|
|
533
|
-
);
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
if (passive) node.attrs = (node.attrs ?? []).filter((item2) => !/^on/iu.test(item2.name));
|
|
537
|
-
for (const item2 of node.attrs ?? []) {
|
|
538
|
-
if (item2.name === "style") item2.value = css(item2.value, dirname2(input.file));
|
|
539
|
-
if (["src", "poster"].includes(item2.name))
|
|
540
|
-
item2.value = asset(item2.value, dirname2(input.file));
|
|
541
|
-
if (item2.name === "srcset")
|
|
542
|
-
throw new Error("Use a local src and responsive CSS for portable design images.");
|
|
543
|
-
if (["action", "formaction", "target", "formtarget"].includes(item2.name) && item2.value.trim())
|
|
544
|
-
throw new Error("Design forms must use local submit handlers without navigation targets.");
|
|
545
|
-
if (item2.name === "href" && !item2.value.startsWith("#")) {
|
|
546
|
-
if (node.tagName === "link" || node.namespaceURI === "http://www.w3.org/2000/svg")
|
|
547
|
-
item2.value = asset(item2.value, dirname2(input.file));
|
|
548
|
-
else if (node.tagName === "a")
|
|
549
|
-
throw new Error('Use data-design-navigate="screen-id" for prototype navigation.');
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
queue.unshift(...children(node));
|
|
553
|
-
}
|
|
554
|
-
const prepend = [];
|
|
555
|
-
for (const path of [...sharedStyles, ...source.styles ?? []]) {
|
|
556
|
-
const linked = read(path);
|
|
557
|
-
prepend.push(
|
|
558
|
-
element(
|
|
559
|
-
"style",
|
|
560
|
-
css(linked.value.toString("utf8"), dirname2(linked.file), /* @__PURE__ */ new Set([linked.file]))
|
|
561
|
-
)
|
|
562
|
-
);
|
|
563
|
-
}
|
|
564
|
-
head.childNodes = [...prepend, ...head.childNodes];
|
|
565
|
-
for (const node of prepend) node.parentNode = head;
|
|
566
|
-
for (const path of source.scripts ?? []) {
|
|
567
|
-
const linked = read(path);
|
|
568
|
-
if (passive) continue;
|
|
569
|
-
const node = element("script", js(linked.value.toString("utf8"), path));
|
|
570
|
-
node.parentNode = body;
|
|
571
|
-
body.childNodes.push(node);
|
|
572
|
-
}
|
|
573
|
-
for (const node of deferredScripts) {
|
|
574
|
-
node.parentNode = body;
|
|
575
|
-
body.childNodes.push(node);
|
|
576
|
-
}
|
|
577
|
-
body.attrs.push({ name: "data-planr-screen", value: screenId });
|
|
578
|
-
const html = serialize(document);
|
|
579
|
-
if (Buffer.byteLength(html) > maxBytes)
|
|
580
|
-
throw new Error("Bundled design exceeds the output budget.");
|
|
581
|
-
return {
|
|
582
|
-
html,
|
|
583
|
-
files: [...files.keys()].map((path) => relative(root, path)),
|
|
584
|
-
sourceDigests: Object.fromEntries(
|
|
585
|
-
[...files].map(([path, value]) => [
|
|
586
|
-
relative(root, path),
|
|
587
|
-
createHash2("sha256").update(value).digest("hex")
|
|
588
|
-
])
|
|
589
|
-
),
|
|
590
|
-
inputBytes: bytes,
|
|
591
|
-
bytes: Buffer.byteLength(html)
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
// packages/protocol/src/review-experience-contracts.mjs
|
|
596
|
-
var text2 = { type: "string", maxLength: 16384 };
|
|
597
|
-
var id = { type: "string", minLength: 1, maxLength: 128 };
|
|
598
|
-
var digest = { type: "string", pattern: "^[a-f0-9]{64}$" };
|
|
599
|
-
var texts = { type: "array", maxItems: 256, items: text2 };
|
|
600
|
-
var closed = (properties, required = Object.keys(properties)) => ({
|
|
601
|
-
type: "object",
|
|
602
|
-
additionalProperties: false,
|
|
603
|
-
properties,
|
|
604
|
-
required
|
|
605
|
-
});
|
|
606
|
-
var list = (items, maxItems = 256) => ({ type: "array", maxItems, items });
|
|
607
|
-
var schema = (name, properties, required) => ({
|
|
608
|
-
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
609
|
-
$id: `https://openplanr.dev/schemas/v1.10.0/${name}.schema.json`,
|
|
610
|
-
"x-openplanr-contract": { id: name, version: "1.10.0" },
|
|
611
|
-
...closed(properties, required)
|
|
612
|
-
});
|
|
613
|
-
var DESIGN_REVIEW_CONTEXT_SCHEMA = schema(
|
|
614
|
-
"design-review-context",
|
|
615
|
-
{
|
|
616
|
-
kind: { const: "openplanr-design-review-context" },
|
|
617
|
-
schemaVersion: { const: "1.0.0" },
|
|
618
|
-
designId: id,
|
|
619
|
-
brief: closed({ purpose: text2, requests: { ...texts, maxItems: 3 }, audience: text2 }, [
|
|
620
|
-
"purpose",
|
|
621
|
-
"requests"
|
|
622
|
-
]),
|
|
623
|
-
revisionSummary: text2,
|
|
624
|
-
implementation: closed({
|
|
625
|
-
tokens: list(closed({ name: id, value: text2, description: text2 }, ["name", "value"]), 512),
|
|
626
|
-
components: list(
|
|
627
|
-
closed(
|
|
628
|
-
{
|
|
629
|
-
id,
|
|
630
|
-
name: text2,
|
|
631
|
-
screenIds: list(id),
|
|
632
|
-
anchorIds: list(id),
|
|
633
|
-
states: list(closed({ name: id, description: text2 })),
|
|
634
|
-
notes: text2,
|
|
635
|
-
responsive: text2,
|
|
636
|
-
accessibility: text2
|
|
637
|
-
},
|
|
638
|
-
["id", "name"]
|
|
639
|
-
)
|
|
640
|
-
),
|
|
641
|
-
responsive: texts,
|
|
642
|
-
accessibility: texts
|
|
643
|
-
})
|
|
644
|
-
},
|
|
645
|
-
["kind", "schemaVersion", "designId", "brief", "implementation"]
|
|
646
|
-
);
|
|
647
|
-
var DESIGN_FINGERPRINT_SCHEMA = closed({
|
|
648
|
-
screenId: id,
|
|
649
|
-
variantId: id,
|
|
650
|
-
frameId: id,
|
|
651
|
-
contentDigest: digest,
|
|
652
|
-
guidanceDigest: digest
|
|
653
|
-
});
|
|
654
|
-
var bundleV11 = {
|
|
655
|
-
.../** @type {MutableSchema} */
|
|
656
|
-
structuredClone(DESIGN_REVIEW_BUNDLE_SCHEMA),
|
|
657
|
-
$id: "https://openplanr.dev/schemas/v1.10.0/design-review-bundle.schema.json",
|
|
658
|
-
"x-openplanr-contract": { id: "design-review-bundle", version: "1.10.0" }
|
|
659
|
-
};
|
|
660
|
-
Object.assign(bundleV11.properties, {
|
|
661
|
-
schemaVersion: { const: "1.1.0" },
|
|
662
|
-
reviewContext: DESIGN_REVIEW_CONTEXT_SCHEMA,
|
|
663
|
-
contextDigest: digest,
|
|
664
|
-
fingerprints: list(DESIGN_FINGERPRINT_SCHEMA)
|
|
665
|
-
});
|
|
666
|
-
bundleV11.required.push("reviewContext", "contextDigest", "fingerprints");
|
|
667
|
-
var DESIGN_REVIEW_BUNDLE_V11_SCHEMA = bundleV11;
|
|
668
|
-
var bundleV12 = (
|
|
669
|
-
/** @type {MutableSchema} */
|
|
670
|
-
structuredClone(DESIGN_REVIEW_BUNDLE_V11_SCHEMA)
|
|
671
|
-
);
|
|
672
|
-
bundleV12.$id = "https://openplanr.dev/schemas/v1.16.0/design-review-bundle.schema.json";
|
|
673
|
-
bundleV12["x-openplanr-contract"] = { id: "design-review-bundle", version: "1.16.0" };
|
|
674
|
-
Object.assign(bundleV12.properties, {
|
|
675
|
-
schemaVersion: { const: "1.2.0" },
|
|
676
|
-
envelope: {
|
|
677
|
-
type: "object",
|
|
678
|
-
required: ["schemaVersion", "sources", "artifacts", "viewer"],
|
|
679
|
-
properties: { schemaVersion: { const: "1.1.0" } }
|
|
680
|
-
},
|
|
681
|
-
entries: {
|
|
682
|
-
.../** @type {Record<string, unknown>} */
|
|
683
|
-
bundleV12.properties.entries,
|
|
684
|
-
maxItems: 4096
|
|
685
|
-
},
|
|
686
|
-
fingerprints: list(DESIGN_FINGERPRINT_SCHEMA, 4096)
|
|
687
|
-
});
|
|
688
|
-
var DESIGN_REVIEW_BUNDLE_V12_SCHEMA = bundleV12;
|
|
689
|
-
var bundleCurrent = (
|
|
690
|
-
/** @type {MutableSchema} */
|
|
691
|
-
structuredClone(bundleV12)
|
|
692
|
-
);
|
|
693
|
-
bundleCurrent.$id = "https://openplanr.dev/schemas/v1.20.0/design-review-bundle.schema.json";
|
|
694
|
-
bundleCurrent["x-openplanr-contract"] = { id: "design-review-bundle", version: "1.20.0" };
|
|
695
|
-
bundleCurrent.properties.schemaVersion = { enum: ["1.1.0", "1.2.0"] };
|
|
696
|
-
bundleCurrent.properties.envelope = bundleV11.properties.envelope;
|
|
697
|
-
bundleCurrent.allOf = [
|
|
698
|
-
{
|
|
699
|
-
if: { properties: { schemaVersion: { const: "1.2.0" } } },
|
|
700
|
-
then: { properties: { envelope: bundleV12.properties.envelope } }
|
|
701
|
-
}
|
|
702
|
-
];
|
|
703
|
-
var currentDesign2 = (
|
|
704
|
-
/** @type {MutableSchema} */
|
|
705
|
-
bundleCurrent.properties.design
|
|
706
|
-
);
|
|
707
|
-
for (const key of ["frames", "layout"])
|
|
708
|
-
currentDesign2.properties[key] = /** @type {Record<string, unknown>} */
|
|
709
|
-
DESIGN_DOCUMENT_SCHEMA.properties[key];
|
|
710
|
-
bundleCurrent.$defs = structuredClone(DESIGN_DOCUMENT_SCHEMA.$defs);
|
|
711
|
-
var currentEntries = (
|
|
712
|
-
/** @type {{ items: { properties: Record<string, unknown> } }} */
|
|
713
|
-
bundleCurrent.properties.entries
|
|
714
|
-
);
|
|
715
|
-
currentEntries.items.properties.height = { const: "auto" };
|
|
716
|
-
var DESIGN_REVIEW_BUNDLE_CURRENT_SCHEMA = bundleCurrent;
|
|
717
|
-
var item = closed(
|
|
718
|
-
{
|
|
719
|
-
pinId: id,
|
|
720
|
-
reviewId: id,
|
|
721
|
-
screenId: id,
|
|
722
|
-
revisionId: id,
|
|
723
|
-
text: text2,
|
|
724
|
-
refinement: text2,
|
|
725
|
-
stale: { type: "boolean" },
|
|
726
|
-
author: text2,
|
|
727
|
-
reviewOf: digest,
|
|
728
|
-
source: text2
|
|
729
|
-
},
|
|
730
|
-
["pinId", "text"]
|
|
731
|
-
);
|
|
732
|
-
var DESIGN_HANDOFF_CONTENT_SCHEMA = closed({
|
|
733
|
-
summary: text2,
|
|
734
|
-
agreedChanges: list(item, 1e4),
|
|
735
|
-
openQuestions: list(item, 1e4),
|
|
736
|
-
deferred: list(item, 1e4),
|
|
737
|
-
rejected: list(item, 1e4)
|
|
738
|
-
});
|
|
739
|
-
var DESIGN_HANDOFF_SCHEMA = schema(
|
|
740
|
-
"design-review-handoff",
|
|
741
|
-
{
|
|
742
|
-
kind: { const: "openplanr-design-review-handoff" },
|
|
743
|
-
schemaVersion: { const: "1.0.0" },
|
|
744
|
-
title: text2,
|
|
745
|
-
version: { type: "integer", minimum: 1 },
|
|
746
|
-
status: { enum: ["draft", "approved"] },
|
|
747
|
-
basis: closed({
|
|
748
|
-
designId: id,
|
|
749
|
-
sourceRevision: digest,
|
|
750
|
-
contextDigest: digest,
|
|
751
|
-
reviewOf: digest,
|
|
752
|
-
selectedVariant: id,
|
|
753
|
-
feedbackDigest: digest,
|
|
754
|
-
verificationDigest: digest,
|
|
755
|
-
feedbackWatermark: { type: "integer", minimum: 0 }
|
|
756
|
-
}),
|
|
757
|
-
content: DESIGN_HANDOFF_CONTENT_SCHEMA,
|
|
758
|
-
contentHash: digest,
|
|
759
|
-
markdown: { type: "string", maxLength: 2097152 },
|
|
760
|
-
affectedScreens: list(id),
|
|
761
|
-
verificationGaps: texts,
|
|
762
|
-
reviewNotes: list(closed({ reviewId: id, text: text2 }), 1e4),
|
|
763
|
-
approval: closed({ contentHash: digest, at: { type: "string", format: "date-time" } })
|
|
764
|
-
},
|
|
765
|
-
[
|
|
766
|
-
"kind",
|
|
767
|
-
"schemaVersion",
|
|
768
|
-
"title",
|
|
769
|
-
"version",
|
|
770
|
-
"status",
|
|
771
|
-
"basis",
|
|
772
|
-
"content",
|
|
773
|
-
"contentHash",
|
|
774
|
-
"markdown",
|
|
775
|
-
"affectedScreens",
|
|
776
|
-
"verificationGaps",
|
|
777
|
-
"reviewNotes"
|
|
778
|
-
]
|
|
779
|
-
);
|
|
780
|
-
var DESIGN_REVIEW_METADATA_PAYLOAD_SCHEMA = {
|
|
781
|
-
...schema(
|
|
782
|
-
"design-review-metadata-payload",
|
|
783
|
-
{
|
|
784
|
-
schemaVersion: { const: "1.0.0" },
|
|
785
|
-
kind: { enum: ["category", "disposition"] },
|
|
786
|
-
author: { ...text2, minLength: 1, maxLength: 160 },
|
|
787
|
-
reviewOf: digest,
|
|
788
|
-
pinId: id,
|
|
789
|
-
category: { enum: ["question", "suggestion", "blocker"] },
|
|
790
|
-
disposition: { enum: ["accepted", "deferred", "rejected"] },
|
|
791
|
-
reason: text2,
|
|
792
|
-
updatedAt: { type: "string", format: "date-time" }
|
|
793
|
-
},
|
|
794
|
-
["schemaVersion", "kind", "author", "reviewOf", "pinId", "updatedAt"]
|
|
795
|
-
),
|
|
796
|
-
allOf: [
|
|
797
|
-
{
|
|
798
|
-
if: { properties: { kind: { const: "category" } } },
|
|
799
|
-
then: { required: ["category"], not: { required: ["disposition"] } }
|
|
800
|
-
},
|
|
801
|
-
{
|
|
802
|
-
if: { properties: { kind: { const: "disposition" } } },
|
|
803
|
-
then: { required: ["disposition", "reason"], not: { required: ["category"] } }
|
|
804
|
-
}
|
|
805
|
-
]
|
|
806
|
-
};
|
|
807
|
-
var payloadV11 = {
|
|
808
|
-
.../** @type {MutableSchema} */
|
|
809
|
-
structuredClone(DESIGN_REVIEW_METADATA_PAYLOAD_SCHEMA),
|
|
810
|
-
$id: "https://openplanr.dev/schemas/v1.11.0/design-review-metadata-payload.schema.json",
|
|
811
|
-
"x-openplanr-contract": { id: "design-review-metadata-payload", version: "1.11.0" }
|
|
812
|
-
};
|
|
813
|
-
Object.assign(payloadV11.properties, {
|
|
814
|
-
schemaVersion: { const: "1.1.0" },
|
|
815
|
-
category: { enum: ["question", "suggestion", "change-request", "blocker"] }
|
|
816
|
-
});
|
|
817
|
-
var DESIGN_REVIEW_METADATA_PAYLOAD_V11_SCHEMA = payloadV11;
|
|
818
|
-
function assertReviewExperience(value, contract) {
|
|
819
|
-
const errors = validateJson(value, contract);
|
|
820
|
-
if (errors.length)
|
|
821
|
-
throw new TypeError(
|
|
822
|
-
`Invalid ${contract["x-openplanr-contract"]?.id ?? "review data"}: ${errors.slice(0, 4).map((item2) => `${item2.path} ${item2.detail}`).join("; ")}`
|
|
823
|
-
);
|
|
824
|
-
return value;
|
|
825
|
-
}
|
|
826
|
-
function assertDesignReviewMetadata(value) {
|
|
827
|
-
return assertReviewExperience(
|
|
828
|
-
value,
|
|
829
|
-
value?.schemaVersion === "1.1.0" ? DESIGN_REVIEW_METADATA_PAYLOAD_V11_SCHEMA : DESIGN_REVIEW_METADATA_PAYLOAD_SCHEMA
|
|
830
|
-
);
|
|
831
|
-
}
|
|
832
|
-
function assertDesignReviewBundle(value) {
|
|
833
|
-
assertReviewExperience(
|
|
834
|
-
value,
|
|
835
|
-
value?.design?.layout !== void 0 || Array.isArray(value?.design?.frames) && value.design.frames.some(({ height }) => height === "auto") ? DESIGN_REVIEW_BUNDLE_CURRENT_SCHEMA : value?.schemaVersion === "1.2.0" ? DESIGN_REVIEW_BUNDLE_V12_SCHEMA : value?.schemaVersion === "1.1.0" ? DESIGN_REVIEW_BUNDLE_V11_SCHEMA : DESIGN_REVIEW_BUNDLE_SCHEMA
|
|
836
|
-
);
|
|
837
|
-
if (["1.1.0", "1.2.0"].includes(value.schemaVersion)) {
|
|
838
|
-
if (value.reviewContext.designId !== value.design.id || value.contextDigest !== sha256Hex(canonicalizeJson(value.reviewContext)))
|
|
839
|
-
throw new TypeError("Review context identity or digest does not match its published design.");
|
|
840
|
-
const entries = new Set(
|
|
841
|
-
value.entries.map((entry) => `${entry.screenId}:${entry.variantId}:${entry.frameId}`)
|
|
842
|
-
);
|
|
843
|
-
const seen = /* @__PURE__ */ new Set();
|
|
844
|
-
for (const item2 of value.fingerprints) {
|
|
845
|
-
const key = `${item2.screenId}:${item2.variantId}:${item2.frameId}`;
|
|
846
|
-
if (!entries.has(key) || seen.has(key))
|
|
847
|
-
throw new TypeError("Review fingerprints must identify distinct published artboards.");
|
|
848
|
-
seen.add(key);
|
|
849
|
-
}
|
|
850
|
-
if (seen.size && seen.size !== entries.size)
|
|
851
|
-
throw new TypeError("Review fingerprints must cover every published artboard.");
|
|
852
|
-
}
|
|
853
|
-
return value;
|
|
854
|
-
}
|
|
855
|
-
var REVIEW_EXPERIENCE_SCHEMAS = Object.freeze({
|
|
856
|
-
"design-review-context": DESIGN_REVIEW_CONTEXT_SCHEMA,
|
|
857
|
-
"design-review-bundle": DESIGN_REVIEW_BUNDLE_V11_SCHEMA,
|
|
858
|
-
"design-review-handoff": DESIGN_HANDOFF_SCHEMA,
|
|
859
|
-
"design-review-metadata-payload": DESIGN_REVIEW_METADATA_PAYLOAD_SCHEMA
|
|
860
|
-
});
|
|
861
|
-
|
|
862
|
-
// packages/design/lib/design/context.mjs
|
|
863
|
-
import { createHash as createHash3 } from "node:crypto";
|
|
864
|
-
import { existsSync, readdirSync, readFileSync as readFileSync3, realpathSync as realpathSync3 } from "node:fs";
|
|
865
|
-
import { dirname as dirname3, join as join2, resolve as resolve3 } from "node:path";
|
|
866
|
-
var reviewDigest = (value) => createHash3("sha256").update(canonicalizeJson(value)).digest("hex");
|
|
867
|
-
function emptyReviewContext(document) {
|
|
868
|
-
return {
|
|
869
|
-
kind: "openplanr-design-review-context",
|
|
870
|
-
schemaVersion: "1.0.0",
|
|
871
|
-
designId: document.id,
|
|
872
|
-
brief: { purpose: "", requests: [] },
|
|
873
|
-
implementation: { tokens: [], components: [], responsive: [], accessibility: [] }
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
function loadReviewContext(root, document, { readSource } = {}) {
|
|
877
|
-
const file = join2(root, "review-context.json");
|
|
878
|
-
if (!existsSync(file)) return emptyReviewContext(document);
|
|
879
|
-
const context = JSON.parse(
|
|
880
|
-
readSource ? readSource("review-context.json", root).value.toString("utf8") : readFileSync3(resolveLocalDocumentFile(root, "review-context.json"), "utf8")
|
|
881
|
-
);
|
|
882
|
-
assertReviewExperience(context, DESIGN_REVIEW_CONTEXT_SCHEMA);
|
|
883
|
-
if (context.designId !== document.id)
|
|
884
|
-
throw new Error("Review context belongs to a different design.");
|
|
885
|
-
const screens = new Set(document.screenOrder);
|
|
886
|
-
const ids = /* @__PURE__ */ new Set();
|
|
887
|
-
for (const component of context.implementation.components) {
|
|
888
|
-
if (ids.has(component.id)) throw new Error("Review component identities must be unique.");
|
|
889
|
-
ids.add(component.id);
|
|
890
|
-
if (component.screenIds?.some((id2) => !screens.has(id2)))
|
|
891
|
-
throw new Error(`Component ${component.id} references an unknown screen.`);
|
|
892
|
-
}
|
|
893
|
-
if (/(?:file:\/\/|\/(?:Users|home|private|tmp|var|etc|opt|Volumes)\/|[A-Za-z]:\\\\|\\\\\\\\)/u.test(
|
|
894
|
-
JSON.stringify(context)
|
|
895
|
-
))
|
|
896
|
-
throw new Error(
|
|
897
|
-
"Review context contains a local filesystem path. Use share-safe implementation guidance."
|
|
898
|
-
);
|
|
899
|
-
return context;
|
|
900
|
-
}
|
|
901
|
-
function reviewFingerprints({ document, context, screen, variant, frame, sourceDigests }) {
|
|
902
|
-
const components = context.implementation.components.filter(
|
|
903
|
-
(component) => !component.screenIds?.length || component.screenIds.includes(screen.id)
|
|
904
|
-
);
|
|
905
|
-
return {
|
|
906
|
-
screenId: screen.id,
|
|
907
|
-
variantId: variant.id,
|
|
908
|
-
frameId: frame.id,
|
|
909
|
-
contentDigest: reviewDigest({
|
|
910
|
-
files: Object.entries(sourceDigests).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0),
|
|
911
|
-
width: frame.width,
|
|
912
|
-
height: frame.height
|
|
913
|
-
}),
|
|
914
|
-
guidanceDigest: reviewDigest({
|
|
915
|
-
title: screen.title,
|
|
916
|
-
description: screen.description ?? "",
|
|
917
|
-
anchors: screen.anchors ?? [],
|
|
918
|
-
variant: { label: variant.label, description: variant.description ?? "" },
|
|
919
|
-
frameLabel: frame.label,
|
|
920
|
-
components,
|
|
921
|
-
tokens: context.implementation.tokens,
|
|
922
|
-
responsive: context.implementation.responsive,
|
|
923
|
-
accessibility: context.implementation.accessibility
|
|
924
|
-
})
|
|
925
|
-
};
|
|
926
|
-
}
|
|
927
|
-
function bundleDesignRevision(current, state = {}) {
|
|
928
|
-
const { document } = current;
|
|
929
|
-
const pick = (value, keys) => Object.fromEntries(
|
|
930
|
-
keys.filter((key) => value?.[key] !== void 0).map((key) => [key, structuredClone(value[key])])
|
|
931
|
-
);
|
|
932
|
-
const context = current.reviewContext ?? emptyReviewContext(document);
|
|
933
|
-
return {
|
|
934
|
-
kind: "openplanr-design-review-bundle",
|
|
935
|
-
schemaVersion: current.envelope.schemaVersion === "1.1.0" ? "1.2.0" : "1.1.0",
|
|
936
|
-
design: {
|
|
937
|
-
...pick(document, [
|
|
938
|
-
"id",
|
|
939
|
-
"title",
|
|
940
|
-
"defaultView",
|
|
941
|
-
"selectedVariant",
|
|
942
|
-
"screenOrder",
|
|
943
|
-
"frames",
|
|
944
|
-
"flows",
|
|
945
|
-
"layout"
|
|
946
|
-
]),
|
|
947
|
-
screens: document.screens.map(
|
|
948
|
-
(screen) => pick(screen, ["id", "title", "description", "anchors"])
|
|
949
|
-
),
|
|
950
|
-
selectedVariant: document.variants.some(
|
|
951
|
-
(variant) => variant.id === state.selectedVariant && variant.status === "ready"
|
|
952
|
-
) ? state.selectedVariant : document.selectedVariant,
|
|
953
|
-
variants: document.variants.filter((variant) => variant.status === "ready").map((variant) => pick(variant, ["id", "label", "status"]))
|
|
954
|
-
},
|
|
955
|
-
envelope: structuredClone(current.envelope),
|
|
956
|
-
entries: structuredClone(current.entries),
|
|
957
|
-
state: {},
|
|
958
|
-
revision: current.revision,
|
|
959
|
-
verification: pick(current.verification ?? {}, ["status"]),
|
|
960
|
-
reviewContext: context,
|
|
961
|
-
contextDigest: current.contextDigest ?? reviewDigest(context),
|
|
962
|
-
fingerprints: current.fingerprints ?? []
|
|
963
|
-
};
|
|
964
|
-
}
|
|
965
|
-
var localRoot = (file) => realpathSync3(dirname3(resolve3(file)));
|
|
966
|
-
function listDesignRevisions(file) {
|
|
967
|
-
const root = localRoot(file);
|
|
968
|
-
const pointer = JSON.parse(readFileSync3(join2(root, ".design/current.json"), "utf8"));
|
|
969
|
-
const revisions = readdirSync(join2(root, ".design/revisions")).filter((name) => /^[a-f0-9]{64}$/u.test(name)).map((revision) => {
|
|
970
|
-
const value = JSON.parse(
|
|
971
|
-
readFileSync3(join2(root, ".design/revisions", revision, "render.json"), "utf8")
|
|
972
|
-
);
|
|
973
|
-
return {
|
|
974
|
-
revision,
|
|
975
|
-
createdAt: value.manifest.generated_at,
|
|
976
|
-
summary: value.reviewContext?.revisionSummary ?? "",
|
|
977
|
-
fingerprints: value.fingerprints ?? []
|
|
978
|
-
};
|
|
979
|
-
}).sort((a, b) => b.createdAt.localeCompare(a.createdAt));
|
|
980
|
-
return { revisions, currentRevision: pointer.revision };
|
|
981
|
-
}
|
|
982
|
-
function readDesignRevision(file, revision) {
|
|
983
|
-
if (!/^[a-f0-9]{64}$/u.test(revision)) throw new Error("Invalid design revision identity.");
|
|
984
|
-
const root = localRoot(file);
|
|
985
|
-
const value = JSON.parse(
|
|
986
|
-
readFileSync3(
|
|
987
|
-
resolveLocalDocumentFile(root, `.design/revisions/${revision}/render.json`),
|
|
988
|
-
"utf8"
|
|
989
|
-
)
|
|
990
|
-
);
|
|
991
|
-
return bundleDesignRevision(value);
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
export {
|
|
995
|
-
serialize,
|
|
996
|
-
parse,
|
|
997
|
-
parseFragment,
|
|
998
|
-
resolveLocalDocumentFile,
|
|
999
|
-
bundleLocalDocument,
|
|
1000
|
-
DESIGN_HANDOFF_CONTENT_SCHEMA,
|
|
1001
|
-
DESIGN_HANDOFF_SCHEMA,
|
|
1002
|
-
assertReviewExperience,
|
|
1003
|
-
assertDesignReviewMetadata,
|
|
1004
|
-
assertDesignReviewBundle,
|
|
1005
|
-
reviewDigest,
|
|
1006
|
-
emptyReviewContext,
|
|
1007
|
-
loadReviewContext,
|
|
1008
|
-
reviewFingerprints,
|
|
1009
|
-
bundleDesignRevision,
|
|
1010
|
-
listDesignRevisions,
|
|
1011
|
-
readDesignRevision,
|
|
1012
|
-
hash,
|
|
1013
|
-
json,
|
|
1014
|
-
readJson,
|
|
1015
|
-
atomicJson,
|
|
1016
|
-
atomicBytes,
|
|
1017
|
-
recoverDesignPublication,
|
|
1018
|
-
designSpecPath,
|
|
1019
|
-
currentDesign
|
|
1020
|
-
};
|