@adea-ai/app-framework 0.0.0-stage → 0.24.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/LICENSE +201 -0
- package/NOTICE +30 -0
- package/README.md +967 -2
- package/dist/app/application.d.ts +47 -0
- package/dist/app/application.js +115 -0
- package/dist/app/create-application.d.ts +13 -0
- package/dist/app/create-application.js +178 -0
- package/dist/app/service-registry.d.ts +44 -0
- package/dist/app/service-registry.js +116 -0
- package/dist/appearance/appearance-host.d.ts +62 -0
- package/dist/appearance/appearance-host.js +115 -0
- package/dist/appearance/appearance-preferences.d.ts +106 -0
- package/dist/appearance/appearance-preferences.js +175 -0
- package/dist/appearance/composition.d.ts +11 -0
- package/dist/appearance/composition.js +16 -0
- package/dist/appearance/custom-theme-import.d.ts +14 -0
- package/dist/appearance/custom-theme-import.js +315 -0
- package/dist/appearance/custom-theme-library.d.ts +146 -0
- package/dist/appearance/custom-theme-library.js +378 -0
- package/dist/appearance/editor.d.ts +20 -0
- package/dist/appearance/editor.js +47 -0
- package/dist/appearance/theme-file-importer.d.ts +23 -0
- package/dist/appearance/theme-file-importer.js +66 -0
- package/dist/appearance/theme-record-adapter.d.ts +26 -0
- package/dist/appearance/theme-record-adapter.js +64 -0
- package/dist/appearance/theme-registry.d.ts +10 -0
- package/dist/appearance/theme-registry.js +16 -0
- package/dist/appearance/window-surface.d.ts +5 -0
- package/dist/appearance/window-surface.js +9 -0
- package/dist/ci/toolchain-identity.d.ts +39 -0
- package/dist/ci/toolchain-identity.js +196 -0
- package/dist/cli/cef-helper-cli.d.ts +2 -0
- package/dist/cli/cef-helper-cli.js +18 -0
- package/dist/cli/cli-runner.d.ts +8 -0
- package/dist/cli/cli-runner.js +23 -0
- package/dist/cli/create-application-cli.d.ts +2 -0
- package/dist/cli/create-application-cli.js +40 -0
- package/dist/cli/electrobun-shortcut-patch-cli.d.ts +2 -0
- package/dist/cli/electrobun-shortcut-patch-cli.js +17 -0
- package/dist/cli/framework-update-cli.d.ts +2 -0
- package/dist/cli/framework-update-cli.js +40 -0
- package/dist/cli/release-assets-plan-cli.d.ts +2 -0
- package/dist/cli/release-assets-plan-cli.js +14 -0
- package/dist/cli/release-cut-cli.d.ts +2 -0
- package/dist/cli/release-cut-cli.js +27 -0
- package/dist/cli/release-descriptor-staging-cli.d.ts +2 -0
- package/dist/cli/release-descriptor-staging-cli.js +45 -0
- package/dist/cli/release-finalize-cli.d.ts +1 -0
- package/dist/cli/release-finalize-cli.js +30 -0
- package/dist/cli/release-promote-cli.d.ts +2 -0
- package/dist/cli/release-promote-cli.js +32 -0
- package/dist/cli/release-publish-cli.d.ts +2 -0
- package/dist/cli/release-publish-cli.js +48 -0
- package/dist/cli/release-sign-cli.d.ts +2 -0
- package/dist/cli/release-sign-cli.js +13 -0
- package/dist/cli/release-step-cli.d.ts +2 -0
- package/dist/cli/release-step-cli.js +44 -0
- package/dist/cli/toolchain-identity-cli.d.ts +2 -0
- package/dist/cli/toolchain-identity-cli.js +10 -0
- package/dist/cli/update-helper-cli.d.ts +1 -0
- package/dist/cli/update-helper-cli.js +10 -0
- package/dist/cli/windows-runtime-patch-cli.d.ts +2 -0
- package/dist/cli/windows-runtime-patch-cli.js +17 -0
- package/dist/desktop/application-command-client.d.ts +15 -0
- package/dist/desktop/application-command-client.js +21 -0
- package/dist/desktop/channel-handshake.d.ts +32 -0
- package/dist/desktop/channel-handshake.js +111 -0
- package/dist/desktop/channel-proof.d.ts +43 -0
- package/dist/desktop/channel-proof.js +85 -0
- package/dist/desktop/client-assets.d.ts +7 -0
- package/dist/desktop/client-assets.js +59 -0
- package/dist/desktop/desktop-client.d.ts +23 -0
- package/dist/desktop/desktop-client.js +231 -0
- package/dist/desktop/desktop-gateway.d.ts +18 -0
- package/dist/desktop/desktop-gateway.js +146 -0
- package/dist/desktop/desktop-host.d.ts +48 -0
- package/dist/desktop/desktop-host.js +208 -0
- package/dist/desktop/desktop-stream.d.ts +36 -0
- package/dist/desktop/desktop-stream.js +231 -0
- package/dist/desktop/loopback-policy.d.ts +19 -0
- package/dist/desktop/loopback-policy.js +23 -0
- package/dist/desktop/open-url-channel.d.ts +15 -0
- package/dist/desktop/open-url-channel.js +55 -0
- package/dist/desktop/string-policy.d.ts +2 -0
- package/dist/desktop/string-policy.js +11 -0
- package/dist/framework-source.json +1 -0
- package/dist/installer/archive-entry.d.ts +6 -0
- package/dist/installer/archive-entry.js +14 -0
- package/dist/installer/command-artifact.d.ts +47 -0
- package/dist/installer/command-artifact.js +261 -0
- package/dist/installer/command-qualification-command.d.ts +12 -0
- package/dist/installer/command-qualification-command.js +71 -0
- package/dist/installer/hosted-runner.d.ts +4 -0
- package/dist/installer/hosted-runner.js +10 -0
- package/dist/installer/installed-payload.d.ts +29 -0
- package/dist/installer/installed-payload.js +312 -0
- package/dist/installer/installer-ci-bootstrap.d.ts +26 -0
- package/dist/installer/installer-ci-bootstrap.js +160 -0
- package/dist/installer/installer-ci-preflight.d.ts +1 -0
- package/dist/installer/installer-ci-preflight.js +49 -0
- package/dist/installer/installer-ci-worker.d.ts +1 -0
- package/dist/installer/installer-ci-worker.js +105 -0
- package/dist/installer/installer-extraction.d.ts +14 -0
- package/dist/installer/installer-extraction.js +289 -0
- package/dist/installer/installer-fetch-guard.d.ts +15 -0
- package/dist/installer/installer-fetch-guard.js +50 -0
- package/dist/installer/installer-identity.d.ts +23 -0
- package/dist/installer/installer-identity.js +286 -0
- package/dist/installer/installer-layout.d.ts +21 -0
- package/dist/installer/installer-layout.js +89 -0
- package/dist/installer/installer-observation.d.ts +64 -0
- package/dist/installer/installer-observation.js +473 -0
- package/dist/installer/installer-process-cleanup.d.ts +18 -0
- package/dist/installer/installer-process-cleanup.js +158 -0
- package/dist/installer/installer-qualification-command.d.ts +11 -0
- package/dist/installer/installer-qualification-command.js +71 -0
- package/dist/installer/installer-renderer-evidence.d.ts +43 -0
- package/dist/installer/installer-renderer-evidence.js +136 -0
- package/dist/installer/installer-upgrade-command.d.ts +37 -0
- package/dist/installer/installer-upgrade-command.js +172 -0
- package/dist/installer/installer-worker-guard.d.ts +21 -0
- package/dist/installer/installer-worker-guard.js +72 -0
- package/dist/installer/native-executable.d.ts +5 -0
- package/dist/installer/native-executable.js +21 -0
- package/dist/installer/upgrade-asset-download.d.ts +13 -0
- package/dist/installer/upgrade-asset-download.js +41 -0
- package/dist/installer/write-all.d.ts +6 -0
- package/dist/installer/write-all.js +11 -0
- package/dist/native/app-bundle.d.ts +28 -0
- package/dist/native/app-bundle.js +60 -0
- package/dist/native/cef-helper.d.ts +28 -0
- package/dist/native/cef-helper.js +402 -0
- package/dist/native/desktop-build-hook.d.ts +7 -0
- package/dist/native/desktop-build-hook.js +20 -0
- package/dist/native/electrobun-source-patch.d.ts +25 -0
- package/dist/native/electrobun-source-patch.js +93 -0
- package/dist/native/linux-cef-links.d.ts +2 -0
- package/dist/native/linux-cef-links.js +15 -0
- package/dist/native/native-secret-store.d.ts +27 -0
- package/dist/native/native-secret-store.js +70 -0
- package/dist/native/native-utilities.d.ts +24 -0
- package/dist/native/native-utilities.js +85 -0
- package/dist/native/partitioned-window.d.ts +34 -0
- package/dist/native/partitioned-window.js +44 -0
- package/dist/native/renderer-profile.d.ts +53 -0
- package/dist/native/renderer-profile.js +30 -0
- package/dist/native/secure-window.d.ts +38 -0
- package/dist/native/secure-window.js +77 -0
- package/dist/native/sidecar-services.d.ts +23 -0
- package/dist/native/sidecar-services.js +46 -0
- package/dist/native/sidecar.d.ts +81 -0
- package/dist/native/sidecar.js +250 -0
- package/dist/native/window-bootstrap.d.ts +24 -0
- package/dist/native/window-bootstrap.js +63 -0
- package/dist/native/window-options.d.ts +32 -0
- package/dist/native/window-options.js +23 -0
- package/dist/native/windows-build-hook-internal.d.ts +2 -0
- package/dist/native/windows-build-hook-internal.js +32 -0
- package/dist/native/windows-build-hook.d.ts +2 -0
- package/dist/native/windows-build-hook.js +12 -0
- package/dist/native/windows-runtime-patch-internal.d.ts +3 -0
- package/dist/native/windows-runtime-patch-internal.js +20 -0
- package/dist/native/windows-runtime-patch.d.ts +4 -0
- package/dist/native/windows-runtime-patch.js +12 -0
- package/dist/release/feed-release-cut.d.ts +23 -0
- package/dist/release/feed-release-cut.js +93 -0
- package/dist/release/feed-state.d.ts +25 -0
- package/dist/release/feed-state.js +81 -0
- package/dist/release/framework-package-publish.d.ts +21 -0
- package/dist/release/framework-package-publish.js +125 -0
- package/dist/release/framework-update.d.ts +30 -0
- package/dist/release/framework-update.js +139 -0
- package/dist/release/github-cli.d.ts +6 -0
- package/dist/release/github-cli.js +16 -0
- package/dist/release/github-release-assets.d.ts +3 -0
- package/dist/release/github-release-assets.js +24 -0
- package/dist/release/github-release-cut.d.ts +14 -0
- package/dist/release/github-release-cut.js +174 -0
- package/dist/release/github-release-lookup.d.ts +7 -0
- package/dist/release/github-release-lookup.js +29 -0
- package/dist/release/github-release-promotion.d.ts +10 -0
- package/dist/release/github-release-promotion.js +78 -0
- package/dist/release/github-release-provenance.d.ts +9 -0
- package/dist/release/github-release-provenance.js +27 -0
- package/dist/release/github-release-publisher.d.ts +9 -0
- package/dist/release/github-release-publisher.js +63 -0
- package/dist/release/github-release-qualification.d.ts +12 -0
- package/dist/release/github-release-qualification.js +80 -0
- package/dist/release/local-provenance.d.ts +24 -0
- package/dist/release/local-provenance.js +72 -0
- package/dist/release/local-release.d.ts +133 -0
- package/dist/release/local-release.js +387 -0
- package/dist/release/macos-dmg.d.ts +22 -0
- package/dist/release/macos-dmg.js +91 -0
- package/dist/release/release-artifact.d.ts +6 -0
- package/dist/release/release-artifact.js +38 -0
- package/dist/release/release-assets-plan.d.ts +14 -0
- package/dist/release/release-assets-plan.js +65 -0
- package/dist/release/release-config.d.ts +76 -0
- package/dist/release/release-config.js +180 -0
- package/dist/release/release-cut-command.d.ts +13 -0
- package/dist/release/release-cut-command.js +39 -0
- package/dist/release/release-cut.d.ts +54 -0
- package/dist/release/release-cut.js +76 -0
- package/dist/release/release-descriptor-staging.d.ts +34 -0
- package/dist/release/release-descriptor-staging.js +147 -0
- package/dist/release/release-finalize.d.ts +16 -0
- package/dist/release/release-finalize.js +104 -0
- package/dist/release/release-promotion-command.d.ts +12 -0
- package/dist/release/release-promotion-command.js +28 -0
- package/dist/release/release-promotion.d.ts +29 -0
- package/dist/release/release-promotion.js +57 -0
- package/dist/release/release-publication.d.ts +33 -0
- package/dist/release/release-publication.js +138 -0
- package/dist/release/release-publish-command.d.ts +7 -0
- package/dist/release/release-publish-command.js +91 -0
- package/dist/release/release-qualification.d.ts +106 -0
- package/dist/release/release-qualification.js +135 -0
- package/dist/release/release-staging.d.ts +9 -0
- package/dist/release/release-staging.js +61 -0
- package/dist/release/release-steps.d.ts +38 -0
- package/dist/release/release-steps.js +147 -0
- package/dist/release/retained-release-build.d.ts +19 -0
- package/dist/release/retained-release-build.js +122 -0
- package/dist/shell/app-shell.d.ts +61 -0
- package/dist/shell/app-shell.js +318 -0
- package/dist/shell/app-utilities.d.ts +122 -0
- package/dist/shell/app-utilities.js +334 -0
- package/dist/shell/application-menu-commands.d.ts +5 -0
- package/dist/shell/application-menu-commands.js +11 -0
- package/dist/shell/application-menu.d.ts +61 -0
- package/dist/shell/application-menu.js +208 -0
- package/dist/shell/help-shortcuts.d.ts +12 -0
- package/dist/shell/help-shortcuts.js +22 -0
- package/dist/shell/settings-sections.d.ts +31 -0
- package/dist/shell/settings-sections.js +50 -0
- package/dist/shell/shortcut-platform.d.ts +17 -0
- package/dist/shell/shortcut-platform.js +25 -0
- package/dist/update-helper.bundle.js +260 -0
- package/dist/updates/channel-update-manager.d.ts +46 -0
- package/dist/updates/channel-update-manager.js +114 -0
- package/dist/updates/desktop-updater.d.ts +104 -0
- package/dist/updates/desktop-updater.js +345 -0
- package/dist/updates/release-feed.d.ts +61 -0
- package/dist/updates/release-feed.js +111 -0
- package/dist/updates/release-location.d.ts +9 -0
- package/dist/updates/release-location.js +80 -0
- package/dist/updates/release-version.d.ts +12 -0
- package/dist/updates/release-version.js +43 -0
- package/dist/updates/signed-release.d.ts +63 -0
- package/dist/updates/signed-release.js +162 -0
- package/dist/updates/stable-file.d.ts +10 -0
- package/dist/updates/stable-file.js +22 -0
- package/dist/updates/update-adapter.d.ts +57 -0
- package/dist/updates/update-adapter.js +72 -0
- package/dist/updates/update-arm.d.ts +24 -0
- package/dist/updates/update-arm.js +95 -0
- package/dist/updates/update-channel-store.d.ts +8 -0
- package/dist/updates/update-channel-store.js +72 -0
- package/dist/updates/update-discovery.d.ts +13 -0
- package/dist/updates/update-discovery.js +56 -0
- package/dist/updates/update-download.d.ts +14 -0
- package/dist/updates/update-download.js +67 -0
- package/dist/updates/update-exclusive-rename.d.ts +2 -0
- package/dist/updates/update-exclusive-rename.js +52 -0
- package/dist/updates/update-extraction.d.ts +18 -0
- package/dist/updates/update-extraction.js +183 -0
- package/dist/updates/update-handoff-plan.d.ts +22 -0
- package/dist/updates/update-handoff-plan.js +28 -0
- package/dist/updates/update-helper.d.ts +24 -0
- package/dist/updates/update-helper.js +56 -0
- package/dist/updates/update-launch.d.ts +5 -0
- package/dist/updates/update-launch.js +27 -0
- package/dist/updates/update-manager.d.ts +40 -0
- package/dist/updates/update-manager.js +83 -0
- package/dist/updates/update-process-fence.d.ts +10 -0
- package/dist/updates/update-process-fence.js +114 -0
- package/dist/updates/update-resume.d.ts +13 -0
- package/dist/updates/update-resume.js +34 -0
- package/dist/updates/update-shutdown.d.ts +15 -0
- package/dist/updates/update-shutdown.js +29 -0
- package/dist/updates/update-state.d.ts +30 -0
- package/dist/updates/update-state.js +18 -0
- package/dist/updates/update-swap-stage.d.ts +27 -0
- package/dist/updates/update-swap-stage.js +58 -0
- package/dist/updates/update-swap.d.ts +10 -0
- package/dist/updates/update-swap.js +30 -0
- package/dist/views/app-about.d.ts +22 -0
- package/dist/views/app-about.js +43 -0
- package/dist/views/app-appearance.d.ts +11 -0
- package/dist/views/app-appearance.js +42 -0
- package/dist/views/app-help.d.ts +17 -0
- package/dist/views/app-help.js +42 -0
- package/dist/views/app-settings.d.ts +26 -0
- package/dist/views/app-settings.js +97 -0
- package/dist/views/appearance-surface.d.ts +9 -0
- package/dist/views/appearance-surface.js +334 -0
- package/dist/views/update-surface.d.ts +34 -0
- package/dist/views/update-surface.js +64 -0
- package/package.json +363 -4
- package/src/app/application.tsx +138 -0
- package/src/app/create-application.ts +245 -0
- package/src/app/service-registry.ts +124 -0
- package/src/appearance/appearance-host.tsx +205 -0
- package/src/appearance/appearance-preferences.ts +287 -0
- package/src/appearance/composition.ts +29 -0
- package/src/appearance/custom-theme-import.ts +424 -0
- package/src/appearance/custom-theme-library.ts +600 -0
- package/src/appearance/editor.ts +94 -0
- package/src/appearance/theme-file-importer.ts +103 -0
- package/src/appearance/theme-record-adapter.ts +106 -0
- package/src/appearance/theme-registry.ts +20 -0
- package/src/appearance/window-surface.ts +18 -0
- package/src/ci/toolchain-identity.ts +244 -0
- package/src/cli/cef-helper-cli.ts +21 -0
- package/src/cli/cli-runner.ts +29 -0
- package/src/cli/create-application-cli.ts +62 -0
- package/src/cli/electrobun-shortcut-patch-cli.ts +24 -0
- package/src/cli/framework-update-cli.ts +41 -0
- package/src/cli/release-assets-plan-cli.ts +14 -0
- package/src/cli/release-cut-cli.ts +41 -0
- package/src/cli/release-descriptor-staging-cli.ts +57 -0
- package/src/cli/release-finalize-cli.ts +34 -0
- package/src/cli/release-promote-cli.ts +31 -0
- package/src/cli/release-publish-cli.ts +46 -0
- package/src/cli/release-sign-cli.ts +24 -0
- package/src/cli/release-step-cli.ts +71 -0
- package/src/cli/toolchain-identity-cli.ts +12 -0
- package/src/cli/update-helper-cli.ts +12 -0
- package/src/cli/windows-runtime-patch-cli.ts +17 -0
- package/src/desktop/application-command-client.ts +43 -0
- package/src/desktop/channel-handshake.ts +136 -0
- package/src/desktop/channel-proof.ts +122 -0
- package/src/desktop/client-assets.ts +75 -0
- package/src/desktop/desktop-client.ts +303 -0
- package/src/desktop/desktop-gateway.ts +189 -0
- package/src/desktop/desktop-host.ts +335 -0
- package/src/desktop/desktop-stream.ts +324 -0
- package/src/desktop/loopback-policy.ts +41 -0
- package/src/desktop/open-url-channel.ts +79 -0
- package/src/desktop/string-policy.ts +9 -0
- package/src/installer/archive-entry.ts +32 -0
- package/src/installer/command-artifact.ts +307 -0
- package/src/installer/command-qualification-command.ts +75 -0
- package/src/installer/hosted-runner.ts +11 -0
- package/src/installer/installed-payload.ts +408 -0
- package/src/installer/installer-ci-bootstrap.ts +199 -0
- package/src/installer/installer-ci-preflight.ts +61 -0
- package/src/installer/installer-ci-worker.ts +105 -0
- package/src/installer/installer-extraction.ts +367 -0
- package/src/installer/installer-fetch-guard.ts +75 -0
- package/src/installer/installer-identity.ts +331 -0
- package/src/installer/installer-layout.ts +167 -0
- package/src/installer/installer-observation.ts +671 -0
- package/src/installer/installer-process-cleanup.ts +167 -0
- package/src/installer/installer-qualification-command.ts +81 -0
- package/src/installer/installer-renderer-evidence.ts +268 -0
- package/src/installer/installer-upgrade-command.ts +226 -0
- package/src/installer/installer-worker-guard.ts +112 -0
- package/src/installer/native-executable.ts +37 -0
- package/src/installer/upgrade-asset-download.ts +72 -0
- package/src/installer/write-all.ts +19 -0
- package/src/native/app-bundle.ts +86 -0
- package/src/native/cef-helper.ts +471 -0
- package/src/native/desktop-build-hook.ts +21 -0
- package/src/native/electrobun-cef-main-frame-bridges.patch +63 -0
- package/src/native/electrobun-source-patch.ts +107 -0
- package/src/native/electrobun-windows-shortcut-com.patch +923 -0
- package/src/native/linux-cef-links.ts +14 -0
- package/src/native/native-secret-store.ts +99 -0
- package/src/native/native-utilities.ts +166 -0
- package/src/native/partitioned-window.ts +62 -0
- package/src/native/renderer-profile.ts +27 -0
- package/src/native/secure-window.ts +115 -0
- package/src/native/sidecar-services.ts +71 -0
- package/src/native/sidecar.ts +387 -0
- package/src/native/window-bootstrap.ts +77 -0
- package/src/native/window-options.ts +24 -0
- package/src/native/windows-build-hook-internal.ts +49 -0
- package/src/native/windows-build-hook.ts +12 -0
- package/src/native/windows-runtime-patch-internal.ts +48 -0
- package/src/native/windows-runtime-patch.ts +15 -0
- package/src/release/feed-release-cut.ts +110 -0
- package/src/release/feed-state.ts +135 -0
- package/src/release/framework-package-publish.ts +163 -0
- package/src/release/framework-update.ts +196 -0
- package/src/release/github-cli.ts +27 -0
- package/src/release/github-release-assets.ts +36 -0
- package/src/release/github-release-cut.ts +237 -0
- package/src/release/github-release-lookup.ts +39 -0
- package/src/release/github-release-promotion.ts +112 -0
- package/src/release/github-release-provenance.ts +65 -0
- package/src/release/github-release-publisher.ts +90 -0
- package/src/release/github-release-qualification.ts +144 -0
- package/src/release/local-provenance.ts +92 -0
- package/src/release/local-release.ts +525 -0
- package/src/release/macos-dmg.ts +113 -0
- package/src/release/release-artifact.ts +53 -0
- package/src/release/release-assets-plan.ts +118 -0
- package/src/release/release-config.ts +420 -0
- package/src/release/release-cut-command.ts +80 -0
- package/src/release/release-cut.ts +133 -0
- package/src/release/release-descriptor-staging.ts +242 -0
- package/src/release/release-finalize.ts +191 -0
- package/src/release/release-promotion-command.ts +36 -0
- package/src/release/release-promotion.ts +132 -0
- package/src/release/release-publication.ts +213 -0
- package/src/release/release-publish-command.ts +163 -0
- package/src/release/release-qualification.ts +397 -0
- package/src/release/release-staging.ts +87 -0
- package/src/release/release-steps.ts +173 -0
- package/src/release/retained-release-build.ts +217 -0
- package/src/shell/app-shell.tsx +285 -0
- package/src/shell/app-utilities.tsx +437 -0
- package/src/shell/application-menu-commands.ts +6 -0
- package/src/shell/application-menu.ts +250 -0
- package/src/shell/help-shortcuts.ts +24 -0
- package/src/shell/settings-sections.ts +74 -0
- package/src/shell/shortcut-platform.ts +35 -0
- package/src/updates/channel-update-manager.ts +127 -0
- package/src/updates/desktop-updater.ts +440 -0
- package/src/updates/release-feed.ts +187 -0
- package/src/updates/release-location.ts +101 -0
- package/src/updates/release-version.ts +57 -0
- package/src/updates/signed-release.ts +311 -0
- package/src/updates/stable-file.ts +32 -0
- package/src/updates/update-adapter.ts +129 -0
- package/src/updates/update-arm.ts +107 -0
- package/src/updates/update-channel-store.ts +86 -0
- package/src/updates/update-discovery.ts +113 -0
- package/src/updates/update-download.ts +82 -0
- package/src/updates/update-exclusive-rename.ts +58 -0
- package/src/updates/update-extraction.ts +261 -0
- package/src/updates/update-handoff-plan.ts +75 -0
- package/src/updates/update-helper.ts +87 -0
- package/src/updates/update-launch.ts +33 -0
- package/src/updates/update-manager.ts +130 -0
- package/src/updates/update-process-fence.ts +125 -0
- package/src/updates/update-resume.ts +34 -0
- package/src/updates/update-shutdown.ts +37 -0
- package/src/updates/update-state.ts +34 -0
- package/src/updates/update-swap-stage.ts +75 -0
- package/src/updates/update-swap.ts +30 -0
- package/src/views/app-about.tsx +44 -0
- package/src/views/app-appearance.tsx +32 -0
- package/src/views/app-help.tsx +43 -0
- package/src/views/app-settings.tsx +88 -0
- package/src/views/appearance-surface.tsx +427 -0
- package/src/views/update-surface.tsx +85 -0
- package/templates/application/.gitattributes +1 -0
- package/templates/application/.github/workflows/release-assets.yml +29 -0
- package/templates/application/.github/workflows/release-finalize.yml +29 -0
- package/templates/application/.github/workflows/release-please.yml +19 -0
- package/templates/application/.github/workflows/release.yml +29 -0
- package/templates/application/.github/workflows/validation.yml +28 -0
- package/templates/application/.oxfmtrc.json +6 -0
- package/templates/application/.oxlintrc.json +48 -0
- package/templates/application/.release-please-manifest.json +3 -0
- package/templates/application/README.md +47 -0
- package/templates/application/electrobun.config.ts +22 -0
- package/templates/application/release-please-config.json +12 -0
- package/templates/application/scripts/app-version.ts +9 -0
- package/templates/application/scripts/build-desktop.ts +34 -0
- package/templates/application/scripts/secure-build.ts +1 -0
- package/templates/application/scripts/stage-release.ts +21 -0
- package/templates/application/src/bun/index.ts +80 -0
- package/templates/application/src/electrobun.d.ts +27 -0
- package/templates/application/src/web/index.html +12 -0
- package/templates/application/src/web/main.tsx +97 -0
- package/templates/application/src/web/public/icon.svg +1 -0
- package/templates/application/src/web/style.css +3 -0
- package/templates/application/tests/app-config.test.ts +9 -0
- package/templates/application/tsconfig.json +15 -0
- package/templates/application/vite.config.ts +10 -0
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import { parseOfflinePolicy, type Requirements } from './release-qualification'
|
|
2
|
+
import { assertSidecarNames } from '../native/app-bundle'
|
|
3
|
+
import { containsAsciiControl } from '../desktop/string-policy'
|
|
4
|
+
import { parseReleaseFeed, type ReleaseFeed } from '../updates/release-feed'
|
|
5
|
+
|
|
6
|
+
const object = (value: unknown): value is Record<string, unknown> =>
|
|
7
|
+
typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
8
|
+
const strings = (value: unknown): value is string[] =>
|
|
9
|
+
Array.isArray(value) &&
|
|
10
|
+
value.length > 0 &&
|
|
11
|
+
value.every(
|
|
12
|
+
(item) =>
|
|
13
|
+
typeof item === 'string' &&
|
|
14
|
+
item.length <= 200 &&
|
|
15
|
+
/^[A-Za-z0-9][A-Za-z0-9._{}-]*$/.test(item) &&
|
|
16
|
+
!item.replaceAll('{tag}', '').includes('{') &&
|
|
17
|
+
!item.replaceAll('{tag}', '').includes('}')
|
|
18
|
+
) &&
|
|
19
|
+
new Set(value).size === value.length
|
|
20
|
+
|
|
21
|
+
const appIdPattern = /^[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)+$/
|
|
22
|
+
const token = (value: unknown): value is string =>
|
|
23
|
+
typeof value === 'string' && /^[A-Za-z0-9][A-Za-z0-9._=-]{0,63}$/.test(value)
|
|
24
|
+
const tokens = (value: unknown, minimum: number): value is string[] =>
|
|
25
|
+
Array.isArray(value) && value.length >= minimum && value.length <= 8 && value.every(token)
|
|
26
|
+
const relativePath = (value: unknown): value is string =>
|
|
27
|
+
typeof value === 'string' &&
|
|
28
|
+
value.length <= 200 &&
|
|
29
|
+
/^[A-Za-z0-9._/-]+$/.test(value) &&
|
|
30
|
+
value.split('/').every((part) => part !== '' && part !== '.' && part !== '..')
|
|
31
|
+
|
|
32
|
+
/** The descriptor target each release platform publishes for. */
|
|
33
|
+
export const platformTargets = {
|
|
34
|
+
'macos-arm64': ['darwin', 'arm64'],
|
|
35
|
+
'windows-x64': ['win32', 'x64'],
|
|
36
|
+
'linux-x64': ['linux', 'x64'],
|
|
37
|
+
} as const
|
|
38
|
+
export type ReleasePlatform = keyof typeof platformTargets
|
|
39
|
+
const releasePlatforms = Object.keys(platformTargets) as ReleasePlatform[]
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A portable command-line payload published beside the desktop payloads: a `.tar.gz` holding one
|
|
43
|
+
* directory named after the asset, with `bin/<executable>` (`bin/<executable>.cmd` on Windows).
|
|
44
|
+
* The build leaves that directory's contents at `build`, relative to the app directory.
|
|
45
|
+
*/
|
|
46
|
+
export type CommandArtifactPolicy = Readonly<{
|
|
47
|
+
kind: string
|
|
48
|
+
/** Update identity its signed descriptors carry; distinct from the desktop app's. */
|
|
49
|
+
appId: string
|
|
50
|
+
executable: string
|
|
51
|
+
build: string
|
|
52
|
+
/** Release asset name template for each release platform. */
|
|
53
|
+
platforms: Readonly<Record<ReleasePlatform, string>>
|
|
54
|
+
qualification: Readonly<{
|
|
55
|
+
/** Extra environment for every qualification command. */
|
|
56
|
+
env: Readonly<Record<string, string>>
|
|
57
|
+
/** Argument lists that must each exit 0 after `--version` prints the release version. */
|
|
58
|
+
probes: readonly (readonly string[])[]
|
|
59
|
+
/** The long-running command started, observed alive, then stopped. */
|
|
60
|
+
service: readonly string[]
|
|
61
|
+
}>
|
|
62
|
+
}>
|
|
63
|
+
|
|
64
|
+
function parseCommandArtifacts(value: unknown, platforms: readonly string[]) {
|
|
65
|
+
if (value === undefined) return []
|
|
66
|
+
if (!object(value) || Object.keys(value).length > 4) throw new Error('Invalid command artifacts')
|
|
67
|
+
return Object.entries(value).map(([kind, policy]): CommandArtifactPolicy => {
|
|
68
|
+
const qualification = object(policy) ? policy.qualification : undefined
|
|
69
|
+
const env = object(qualification) ? qualification.env : undefined
|
|
70
|
+
if (
|
|
71
|
+
!/^[a-z][a-z0-9-]{0,31}$/.test(kind) ||
|
|
72
|
+
!object(policy) ||
|
|
73
|
+
Object.keys(policy).length !== 5 ||
|
|
74
|
+
typeof policy.appId !== 'string' ||
|
|
75
|
+
policy.appId.length > 255 ||
|
|
76
|
+
!appIdPattern.test(policy.appId) ||
|
|
77
|
+
typeof policy.executable !== 'string' ||
|
|
78
|
+
!/^[a-z][a-z0-9-]{0,63}$/.test(policy.executable) ||
|
|
79
|
+
!relativePath(policy.build) ||
|
|
80
|
+
!object(policy.platforms) ||
|
|
81
|
+
Object.keys(policy.platforms).length !== platforms.length ||
|
|
82
|
+
platforms.some(
|
|
83
|
+
(platform) =>
|
|
84
|
+
typeof (policy.platforms as Record<string, unknown>)[platform] !== 'string' ||
|
|
85
|
+
!strings([(policy.platforms as Record<string, string>)[platform]]) ||
|
|
86
|
+
!(policy.platforms as Record<string, string>)[platform]!.endsWith('.tar.gz')
|
|
87
|
+
) ||
|
|
88
|
+
!object(qualification) ||
|
|
89
|
+
Object.keys(qualification).length !== 3 ||
|
|
90
|
+
!object(env) ||
|
|
91
|
+
Object.keys(env).length > 16 ||
|
|
92
|
+
Object.entries(env).some(
|
|
93
|
+
([name, item]) =>
|
|
94
|
+
!/^[A-Z][A-Z0-9_]{0,63}$/.test(name) ||
|
|
95
|
+
/^(?:PATH|HOME|USERPROFILE|TMP|TEMP|TMPDIR|SYSTEMROOT|WINDIR|COMSPEC|PATHEXT|LOCALAPPDATA|APPDATA|XDG_[A-Z_]+)$/.test(
|
|
96
|
+
name
|
|
97
|
+
) ||
|
|
98
|
+
typeof item !== 'string' ||
|
|
99
|
+
item.length > 256 ||
|
|
100
|
+
containsAsciiControl(item)
|
|
101
|
+
) ||
|
|
102
|
+
!Array.isArray(qualification.probes) ||
|
|
103
|
+
qualification.probes.length > 8 ||
|
|
104
|
+
!qualification.probes.every((probe) => tokens(probe, 1)) ||
|
|
105
|
+
!tokens(qualification.service, 1)
|
|
106
|
+
)
|
|
107
|
+
throw new Error('Invalid command artifact')
|
|
108
|
+
return {
|
|
109
|
+
kind,
|
|
110
|
+
appId: policy.appId,
|
|
111
|
+
executable: policy.executable,
|
|
112
|
+
build: policy.build,
|
|
113
|
+
platforms: Object.fromEntries(
|
|
114
|
+
platforms.map((platform) => [
|
|
115
|
+
platform,
|
|
116
|
+
(policy.platforms as Record<string, string>)[platform],
|
|
117
|
+
])
|
|
118
|
+
) as Record<ReleasePlatform, string>,
|
|
119
|
+
qualification: {
|
|
120
|
+
env: { ...(env as Record<string, string>) },
|
|
121
|
+
probes: (qualification.probes as string[][]).map((probe) => [...probe]),
|
|
122
|
+
service: [...(qualification.service as string[])],
|
|
123
|
+
},
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const workflowDirectory = '.github/workflows/'
|
|
129
|
+
/** Caller workflows whose runs the release CLIs accept as provenance. */
|
|
130
|
+
export type ReleaseWorkflows = { control: string; assets: string }
|
|
131
|
+
/** The file name GitHub's workflow APIs and `gh workflow run` address a workflow by. */
|
|
132
|
+
export const workflowFile = (path: string) => path.slice(workflowDirectory.length)
|
|
133
|
+
const workflowPath = (value: unknown): value is string =>
|
|
134
|
+
typeof value === 'string' &&
|
|
135
|
+
value.length <= 200 &&
|
|
136
|
+
value.startsWith(workflowDirectory) &&
|
|
137
|
+
/^[A-Za-z0-9][A-Za-z0-9._-]*\.ya?ml$/.test(workflowFile(value))
|
|
138
|
+
|
|
139
|
+
/** Validate shared daily, dev and stable asset requirements. */
|
|
140
|
+
export function parseReleaseConfig(config: unknown): {
|
|
141
|
+
soakHours: number
|
|
142
|
+
expectedReads: readonly string[]
|
|
143
|
+
versionSource: { kind: 'source-manifest'; path: string }
|
|
144
|
+
releasePleaseManifestPath: string
|
|
145
|
+
/** Sidecar executables every packaged payload must contain. */
|
|
146
|
+
sidecars: readonly string[]
|
|
147
|
+
releaseWorkflows: ReleaseWorkflows
|
|
148
|
+
/** The HTTPS feed releases are published to and discovered from. */
|
|
149
|
+
feed: ReleaseFeed
|
|
150
|
+
commandArtifacts: readonly CommandArtifactPolicy[]
|
|
151
|
+
requirements(tag: string): Requirements
|
|
152
|
+
} {
|
|
153
|
+
if (
|
|
154
|
+
!object(config) ||
|
|
155
|
+
!object(config.platforms) ||
|
|
156
|
+
!strings(config.releaseAssets) ||
|
|
157
|
+
!strings(config.dailyDiscoveryAssets) ||
|
|
158
|
+
!strings(config.stableDiscoveryAssets) ||
|
|
159
|
+
!strings(config.devDiscoveryAssets) ||
|
|
160
|
+
!Number.isSafeInteger(config.soakHours) ||
|
|
161
|
+
Number(config.soakHours) < 0 ||
|
|
162
|
+
Number(config.soakHours) > 8760
|
|
163
|
+
)
|
|
164
|
+
throw new Error('Invalid release configuration')
|
|
165
|
+
const workflows = config.releaseWorkflows
|
|
166
|
+
if (
|
|
167
|
+
!object(workflows) ||
|
|
168
|
+
Object.keys(workflows).length !== 2 ||
|
|
169
|
+
!workflowPath(workflows.control) ||
|
|
170
|
+
!workflowPath(workflows.assets) ||
|
|
171
|
+
workflows.control === workflows.assets
|
|
172
|
+
)
|
|
173
|
+
throw new Error('Invalid release workflows')
|
|
174
|
+
const releaseWorkflows = { control: workflows.control, assets: workflows.assets }
|
|
175
|
+
const feed = parseReleaseFeed(config.releaseFeed)
|
|
176
|
+
let sidecars: readonly string[]
|
|
177
|
+
try {
|
|
178
|
+
sidecars = assertSidecarNames(config.sidecars ?? [])
|
|
179
|
+
} catch {
|
|
180
|
+
throw new Error('Invalid release sidecars')
|
|
181
|
+
}
|
|
182
|
+
const offlinePolicy =
|
|
183
|
+
config.offlinePolicy === undefined ? undefined : parseOfflinePolicy(config.offlinePolicy)
|
|
184
|
+
const source = config.versionSource
|
|
185
|
+
if (
|
|
186
|
+
!object(source) ||
|
|
187
|
+
Object.keys(source).length !== 2 ||
|
|
188
|
+
source.kind !== 'source-manifest' ||
|
|
189
|
+
typeof source.path !== 'string' ||
|
|
190
|
+
source.path.length > 200 ||
|
|
191
|
+
!/^[A-Za-z0-9._/-]+\.json$/.test(source.path) ||
|
|
192
|
+
source.path.startsWith('/') ||
|
|
193
|
+
!source.path.split('/').every((part) => part !== '' && part !== '.' && part !== '..')
|
|
194
|
+
)
|
|
195
|
+
throw new Error('Invalid release version source')
|
|
196
|
+
// Release Please owns the version: every daily and stable tag is a Release Please
|
|
197
|
+
// release of this manifest, and dev builds are -dev.N of the next minor version.
|
|
198
|
+
const versionSource = { kind: 'source-manifest' as const, path: source.path }
|
|
199
|
+
const releasePleaseManifestPath = source.path
|
|
200
|
+
const expectedReads = config.offlineExpectedReads === undefined ? [] : config.offlineExpectedReads
|
|
201
|
+
if (
|
|
202
|
+
!Array.isArray(expectedReads) ||
|
|
203
|
+
expectedReads.length > 32 ||
|
|
204
|
+
new Set(expectedReads).size !== expectedReads.length ||
|
|
205
|
+
JSON.stringify(expectedReads).length > 8192
|
|
206
|
+
)
|
|
207
|
+
throw new Error('Invalid offline expected reads')
|
|
208
|
+
for (const item of expectedReads) {
|
|
209
|
+
if (typeof item !== 'string' || item.length > 2048)
|
|
210
|
+
throw new Error('Invalid offline expected read')
|
|
211
|
+
let url: URL
|
|
212
|
+
try {
|
|
213
|
+
url = new URL(item)
|
|
214
|
+
} catch {
|
|
215
|
+
throw new Error('Invalid offline expected read')
|
|
216
|
+
}
|
|
217
|
+
if (url.protocol !== 'https:' || url.username || url.password || url.hash || url.href !== item)
|
|
218
|
+
throw new Error('Invalid offline expected read')
|
|
219
|
+
}
|
|
220
|
+
const platforms = config.platforms
|
|
221
|
+
for (const required of releasePlatforms)
|
|
222
|
+
if (!Object.hasOwn(platforms, required))
|
|
223
|
+
throw new Error('Releases require all supported desktop platforms')
|
|
224
|
+
for (const [platform, assets] of Object.entries(platforms))
|
|
225
|
+
if (!/^[a-z0-9-]+$/.test(platform) || !strings(assets))
|
|
226
|
+
throw new Error('Invalid release platform configuration')
|
|
227
|
+
// Keep the validated requirements independent of subsequent caller mutations.
|
|
228
|
+
const platformSnapshot = Object.fromEntries(
|
|
229
|
+
Object.entries(platforms).map(([platform, assets]) => [platform, [...(assets as string[])]])
|
|
230
|
+
)
|
|
231
|
+
const commandArtifacts = parseCommandArtifacts(config.commandArtifacts, Object.keys(platforms))
|
|
232
|
+
const appIds = [config.appId, ...commandArtifacts.map((artifact) => artifact.appId)]
|
|
233
|
+
if (new Set(appIds).size !== appIds.length)
|
|
234
|
+
throw new Error('Command artifacts need their own update identity')
|
|
235
|
+
const releaseAssets = [...config.releaseAssets]
|
|
236
|
+
const daily = [...config.dailyDiscoveryAssets]
|
|
237
|
+
const stable = [...config.stableDiscoveryAssets]
|
|
238
|
+
const dev = [...config.devDiscoveryAssets]
|
|
239
|
+
if (
|
|
240
|
+
daily.some(
|
|
241
|
+
(name) => !releaseAssets.includes(name) || stable.includes(name) || dev.includes(name)
|
|
242
|
+
) ||
|
|
243
|
+
stable.some((name) => !releaseAssets.includes(name) || dev.includes(name)) ||
|
|
244
|
+
dev.some((name) => !releaseAssets.includes(name))
|
|
245
|
+
)
|
|
246
|
+
throw new Error('Daily, stable and dev discovery assets must be distinct release assets')
|
|
247
|
+
const requirements = (tag: string): Requirements => {
|
|
248
|
+
if (!/^v\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(tag) || tag.length > 65)
|
|
249
|
+
throw new Error('Invalid release tag')
|
|
250
|
+
const isDev = tag.includes('-dev.')
|
|
251
|
+
const selectedAssets = releaseAssets.filter((name) =>
|
|
252
|
+
isDev ? !daily.includes(name) && !stable.includes(name) : !dev.includes(name)
|
|
253
|
+
)
|
|
254
|
+
const substitute = (value: string) => value.replaceAll('{tag}', tag)
|
|
255
|
+
const result = {
|
|
256
|
+
platforms: Object.fromEntries(
|
|
257
|
+
Object.entries(platformSnapshot).map(([platform, assets]) => [
|
|
258
|
+
platform,
|
|
259
|
+
assets.map(substitute),
|
|
260
|
+
])
|
|
261
|
+
),
|
|
262
|
+
releaseAssets: selectedAssets.map(substitute),
|
|
263
|
+
...(offlinePolicy ? { offlinePolicy: { ...offlinePolicy } } : {}),
|
|
264
|
+
...(commandArtifacts.length
|
|
265
|
+
? {
|
|
266
|
+
commandArtifacts: Object.fromEntries(
|
|
267
|
+
commandArtifacts.map((artifact) => [
|
|
268
|
+
artifact.kind,
|
|
269
|
+
Object.fromEntries(
|
|
270
|
+
Object.entries(artifact.platforms).map(([platform, name]) => [
|
|
271
|
+
platform,
|
|
272
|
+
substitute(name),
|
|
273
|
+
])
|
|
274
|
+
),
|
|
275
|
+
])
|
|
276
|
+
),
|
|
277
|
+
}
|
|
278
|
+
: {}),
|
|
279
|
+
}
|
|
280
|
+
const names = releaseAssetNames(result)
|
|
281
|
+
if (
|
|
282
|
+
new Set(names).size !== names.length ||
|
|
283
|
+
names.some((name) => !/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(name))
|
|
284
|
+
)
|
|
285
|
+
throw new Error('Invalid or duplicate release asset names')
|
|
286
|
+
return result
|
|
287
|
+
}
|
|
288
|
+
// Validate names even while held, before a scheduled workflow is enabled.
|
|
289
|
+
requirements('v1.0.0')
|
|
290
|
+
return {
|
|
291
|
+
soakHours: config.soakHours as number,
|
|
292
|
+
expectedReads: [...expectedReads],
|
|
293
|
+
versionSource,
|
|
294
|
+
releasePleaseManifestPath,
|
|
295
|
+
sidecars,
|
|
296
|
+
releaseWorkflows,
|
|
297
|
+
feed,
|
|
298
|
+
commandArtifacts,
|
|
299
|
+
requirements,
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** Every payload and release asset a release's requirements name, desktop payloads first. */
|
|
304
|
+
export function releaseAssetNames(requirements: Requirements): string[] {
|
|
305
|
+
return [
|
|
306
|
+
...Object.values(requirements.platforms).flat(),
|
|
307
|
+
...Object.values(requirements.commandArtifacts ?? {}).flatMap((byPlatform) =>
|
|
308
|
+
Object.values(byPlatform)
|
|
309
|
+
),
|
|
310
|
+
...requirements.releaseAssets,
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** The payloads one platform's build stages: its installer and archive, then its command artifacts. */
|
|
315
|
+
export function platformPayloads(requirements: Requirements, platform: string): string[] {
|
|
316
|
+
return [
|
|
317
|
+
...(requirements.platforms[platform] ?? []),
|
|
318
|
+
...Object.values(requirements.commandArtifacts ?? {}).map((byPlatform) => {
|
|
319
|
+
const name = byPlatform[platform]
|
|
320
|
+
if (!name) throw new Error('Command artifact is missing a platform')
|
|
321
|
+
return name
|
|
322
|
+
}),
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export type DiscoveryPolicy = Readonly<{
|
|
327
|
+
/** Discovery asset name for this tag. */
|
|
328
|
+
name: string
|
|
329
|
+
channel: 'dev' | 'daily' | 'stable'
|
|
330
|
+
platform: ReleasePlatform
|
|
331
|
+
os: (typeof platformTargets)[ReleasePlatform][0]
|
|
332
|
+
arch: (typeof platformTargets)[ReleasePlatform][1]
|
|
333
|
+
/** The update identity the descriptor carries. */
|
|
334
|
+
appId: string
|
|
335
|
+
/** The one payload the descriptor may name. */
|
|
336
|
+
payload: string
|
|
337
|
+
}>
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Resolve the channel descriptors a tag publishes: one per channel, payload kind (the desktop
|
|
341
|
+
* archive and each command artifact) and platform, each naming exactly that payload.
|
|
342
|
+
*/
|
|
343
|
+
export function discoveryPolicies(config: unknown, tag: string): DiscoveryPolicy[] {
|
|
344
|
+
const parsed = parseReleaseConfig(config)
|
|
345
|
+
const requirements = parsed.requirements(tag)
|
|
346
|
+
if (
|
|
347
|
+
!object(config) ||
|
|
348
|
+
typeof config.appId !== 'string' ||
|
|
349
|
+
config.appId.length > 255 ||
|
|
350
|
+
!appIdPattern.test(config.appId) ||
|
|
351
|
+
!object(config.descriptors)
|
|
352
|
+
)
|
|
353
|
+
throw new Error('Invalid discovery policy')
|
|
354
|
+
const descriptors = config.descriptors
|
|
355
|
+
const kinds = [
|
|
356
|
+
{
|
|
357
|
+
appId: config.appId,
|
|
358
|
+
payloads: (platform: ReleasePlatform) => requirements.platforms[platform]![1],
|
|
359
|
+
},
|
|
360
|
+
...parsed.commandArtifacts.map((artifact) => ({
|
|
361
|
+
appId: artifact.appId,
|
|
362
|
+
payloads: (platform: ReleasePlatform) =>
|
|
363
|
+
requirements.commandArtifacts![artifact.kind]![platform]!,
|
|
364
|
+
})),
|
|
365
|
+
]
|
|
366
|
+
const channels = tag.includes('-dev.') ? (['dev'] as const) : (['daily', 'stable'] as const)
|
|
367
|
+
const result: DiscoveryPolicy[] = []
|
|
368
|
+
for (const channel of channels) {
|
|
369
|
+
const configured = config[`${channel}DiscoveryAssets`]
|
|
370
|
+
if (!Array.isArray(configured)) throw new Error('Invalid discovery policy')
|
|
371
|
+
for (const template of configured) {
|
|
372
|
+
const policy = typeof template === 'string' ? descriptors[template] : undefined
|
|
373
|
+
const platform = object(policy)
|
|
374
|
+
? releasePlatforms.find(
|
|
375
|
+
(value) =>
|
|
376
|
+
policy.platform === platformTargets[value][0] &&
|
|
377
|
+
policy.arch === platformTargets[value][1]
|
|
378
|
+
)
|
|
379
|
+
: undefined
|
|
380
|
+
const payload =
|
|
381
|
+
object(policy) &&
|
|
382
|
+
Array.isArray(policy.allowedPayloads) &&
|
|
383
|
+
policy.allowedPayloads.length === 1 &&
|
|
384
|
+
typeof policy.allowedPayloads[0] === 'string'
|
|
385
|
+
? policy.allowedPayloads[0].replaceAll('{tag}', tag)
|
|
386
|
+
: undefined
|
|
387
|
+
const kind = platform && kinds.find((value) => value.payloads(platform) === payload)
|
|
388
|
+
const name = (template as string).replaceAll('{tag}', tag)
|
|
389
|
+
if (
|
|
390
|
+
!object(policy) ||
|
|
391
|
+
policy.channel !== channel ||
|
|
392
|
+
!platform ||
|
|
393
|
+
!kind ||
|
|
394
|
+
!payload ||
|
|
395
|
+
!requirements.releaseAssets.includes(name)
|
|
396
|
+
)
|
|
397
|
+
throw new Error('Invalid discovery policy')
|
|
398
|
+
if (
|
|
399
|
+
result.some(
|
|
400
|
+
(value) =>
|
|
401
|
+
value.name === name ||
|
|
402
|
+
(value.channel === channel && value.appId === kind.appId && value.platform === platform)
|
|
403
|
+
)
|
|
404
|
+
)
|
|
405
|
+
throw new Error('Duplicate discovery policy')
|
|
406
|
+
const [os, arch] = platformTargets[platform]
|
|
407
|
+
result.push({ name, channel, platform, os, arch, appId: kind.appId, payload })
|
|
408
|
+
}
|
|
409
|
+
for (const kind of kinds)
|
|
410
|
+
for (const platform of releasePlatforms)
|
|
411
|
+
if (
|
|
412
|
+
!result.some(
|
|
413
|
+
(value) =>
|
|
414
|
+
value.channel === channel && value.appId === kind.appId && value.platform === platform
|
|
415
|
+
)
|
|
416
|
+
)
|
|
417
|
+
throw new Error('Missing platform discovery policy')
|
|
418
|
+
}
|
|
419
|
+
return result
|
|
420
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process'
|
|
2
|
+
import { githubCli } from './github-cli'
|
|
3
|
+
import { promisify } from 'node:util'
|
|
4
|
+
import { createGitHubReleaseCutProvider } from './github-release-cut'
|
|
5
|
+
import { cutRelease } from './release-cut'
|
|
6
|
+
import { parseReleaseConfig, workflowFile } from './release-config'
|
|
7
|
+
import { readSourceVersion } from './local-provenance'
|
|
8
|
+
|
|
9
|
+
const execute = promisify(execFile)
|
|
10
|
+
/** Execute release cuts only from the recorded main-branch GitHub workflow. */
|
|
11
|
+
export async function runReleaseCutCommand(options: {
|
|
12
|
+
env: Record<string, string | undefined>
|
|
13
|
+
kind: 'dev' | 'daily'
|
|
14
|
+
appName: string
|
|
15
|
+
config: unknown
|
|
16
|
+
run?: (args: string[], input?: string) => Promise<string>
|
|
17
|
+
git?: (args: string[]) => Promise<string>
|
|
18
|
+
}) {
|
|
19
|
+
const { env, kind } = options
|
|
20
|
+
if (
|
|
21
|
+
env.GITHUB_ACTIONS !== 'true' ||
|
|
22
|
+
env.GITHUB_REF !== 'refs/heads/main' ||
|
|
23
|
+
!env.GITHUB_REPOSITORY ||
|
|
24
|
+
!/^[a-f0-9]{40}$/.test(env.GITHUB_SHA ?? '') ||
|
|
25
|
+
!/^[1-9]\d{0,19}$/.test(env.GITHUB_RUN_ID ?? '') ||
|
|
26
|
+
!/^[1-9]\d{0,8}$/.test(env.GITHUB_RUN_ATTEMPT ?? '') ||
|
|
27
|
+
(kind === 'daily'
|
|
28
|
+
? !['schedule', 'workflow_dispatch'].includes(env.GITHUB_EVENT_NAME ?? '')
|
|
29
|
+
: kind === 'dev'
|
|
30
|
+
? !['push', 'workflow_dispatch'].includes(env.GITHUB_EVENT_NAME ?? '')
|
|
31
|
+
: true)
|
|
32
|
+
)
|
|
33
|
+
throw new Error('Release cut requires a trusted main workflow')
|
|
34
|
+
const { requirements, versionSource, releasePleaseManifestPath, releaseWorkflows } =
|
|
35
|
+
parseReleaseConfig(options.config)
|
|
36
|
+
const run = options.run ?? githubCli()
|
|
37
|
+
const git =
|
|
38
|
+
options.git ??
|
|
39
|
+
(async (args: string[]) =>
|
|
40
|
+
(await execute('git', args, { maxBuffer: 1024 * 1024 })).stdout.trim())
|
|
41
|
+
const repository = env.GITHUB_REPOSITORY
|
|
42
|
+
const sourceSha = env.GITHUB_SHA!
|
|
43
|
+
const provider = createGitHubReleaseCutProvider({
|
|
44
|
+
repository,
|
|
45
|
+
appName: options.appName,
|
|
46
|
+
requirements,
|
|
47
|
+
assetsWorkflow: releaseWorkflows.assets,
|
|
48
|
+
releasePleaseManifestPath,
|
|
49
|
+
run,
|
|
50
|
+
})
|
|
51
|
+
const workflow = JSON.parse(
|
|
52
|
+
await run(['api', `repos/${repository}/actions/runs/${env.GITHUB_RUN_ID}`])
|
|
53
|
+
) as {
|
|
54
|
+
id?: unknown
|
|
55
|
+
run_attempt?: unknown
|
|
56
|
+
head_sha?: unknown
|
|
57
|
+
event?: unknown
|
|
58
|
+
path?: unknown
|
|
59
|
+
repository?: { full_name?: unknown }
|
|
60
|
+
}
|
|
61
|
+
if (
|
|
62
|
+
String(workflow?.id) !== env.GITHUB_RUN_ID ||
|
|
63
|
+
String(workflow?.run_attempt) !== env.GITHUB_RUN_ATTEMPT ||
|
|
64
|
+
workflow?.head_sha !== sourceSha ||
|
|
65
|
+
workflow?.event !== env.GITHUB_EVENT_NAME ||
|
|
66
|
+
workflow?.path !== releaseWorkflows.control ||
|
|
67
|
+
workflow?.repository?.full_name !== repository
|
|
68
|
+
)
|
|
69
|
+
throw new Error('Release workflow provenance mismatch')
|
|
70
|
+
const assetsWorkflow = JSON.parse(
|
|
71
|
+
await run([
|
|
72
|
+
'api',
|
|
73
|
+
`repos/${repository}/actions/workflows/${workflowFile(releaseWorkflows.assets)}`,
|
|
74
|
+
])
|
|
75
|
+
) as { path?: unknown; state?: unknown }
|
|
76
|
+
if (assetsWorkflow?.path !== releaseWorkflows.assets || assetsWorkflow?.state !== 'active')
|
|
77
|
+
throw new Error('Release-assets workflow is unavailable')
|
|
78
|
+
const releasedVersion = await readSourceVersion(git, sourceSha, versionSource.path)
|
|
79
|
+
return cutRelease({ kind, sourceSha, releasedVersion, provider })
|
|
80
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/** Release identity selection adapted from adea-ai/adea scripts/release-control.mjs,
|
|
2
|
+
* commit 6155d18941acbb14d9099bc2a33a50ee9683a068 (Apache-2.0). */
|
|
3
|
+
export type CutRelease = {
|
|
4
|
+
tag: string
|
|
5
|
+
sourceSha: string
|
|
6
|
+
kind: 'dev' | 'daily'
|
|
7
|
+
draft: boolean
|
|
8
|
+
prerelease: boolean
|
|
9
|
+
stageableDraft?: boolean
|
|
10
|
+
}
|
|
11
|
+
export type ReleaseCutProvider = {
|
|
12
|
+
/** Return a release only after independently resolving its tag target and channel marker. */
|
|
13
|
+
find(tag: string): Promise<CutRelease | null>
|
|
14
|
+
isMainAncestor(sha: string): Promise<boolean>
|
|
15
|
+
/** Whether `newer` strictly descends from `older`. */
|
|
16
|
+
isAncestor(older: string, newer: string): Promise<boolean>
|
|
17
|
+
/** Create a dev prerelease for the tag at the source commit. */
|
|
18
|
+
create(identity: Pick<CutRelease, 'tag' | 'sourceSha'>): Promise<void>
|
|
19
|
+
qualification(release: CutRelease): Promise<'qualified' | 'not-qualified' | 'unknown'>
|
|
20
|
+
pendingBuild(release: CutRelease): Promise<'pending' | 'idle' | 'unknown'>
|
|
21
|
+
/** Inspect all existing dev releases of a dev version line; errors must fail closed. */
|
|
22
|
+
highestDevCounter(version: string): Promise<number>
|
|
23
|
+
/** Check the actual Git tag even when no release exists. */
|
|
24
|
+
tagExists(tag: string): Promise<boolean>
|
|
25
|
+
dispatch(tag: string): Promise<void>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The version dev builds after `released` are numbered for: the next minor version.
|
|
30
|
+
* Release Please writes a version to the manifest only when it releases it, so the
|
|
31
|
+
* source manifest always names a released version (or the one its own commit
|
|
32
|
+
* releases). The next release is a patch or minor above it, or a new major, so dev
|
|
33
|
+
* builds of the next minor sort above the release they follow, and stay strictly
|
|
34
|
+
* increasing across a patch release, which leaves the next minor unchanged.
|
|
35
|
+
*/
|
|
36
|
+
export function nextDevVersion(released: string): string {
|
|
37
|
+
const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(released)
|
|
38
|
+
if (!match) throw new Error('Invalid release identity')
|
|
39
|
+
return `${match[1]}.${BigInt(match[2]!) + 1n}.0`
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Cut or repair a daily/dev release without moving an existing tag. A daily is the
|
|
44
|
+
* Release Please release `v<version>` of the source manifest's version. A dev build is
|
|
45
|
+
* `v<next>-dev.N` for the next unreleased version (see `nextDevVersion`), where N counts
|
|
46
|
+
* that version's dev releases from 1, so it starts again at 1 when a release moves the
|
|
47
|
+
* next version: `v0.112.0-dev.15` is followed, after the `v0.112.0` release, by
|
|
48
|
+
* `v0.113.0-dev.1`.
|
|
49
|
+
*/
|
|
50
|
+
export async function cutRelease(options: {
|
|
51
|
+
kind: 'dev' | 'daily'
|
|
52
|
+
sourceSha: string
|
|
53
|
+
/** The version in the source manifest at the exact source commit: the latest release. */
|
|
54
|
+
releasedVersion: string
|
|
55
|
+
provider: ReleaseCutProvider
|
|
56
|
+
}): Promise<{ tag: string; sourceSha: string; status: 'qualified' | 'pending' | 'dispatched' }> {
|
|
57
|
+
const { kind, sourceSha, releasedVersion, provider } = options
|
|
58
|
+
if (
|
|
59
|
+
!['daily', 'dev'].includes(kind) ||
|
|
60
|
+
!/^[a-f0-9]{40}$/.test(sourceSha) ||
|
|
61
|
+
typeof releasedVersion !== 'string' ||
|
|
62
|
+
releasedVersion.length > 48 ||
|
|
63
|
+
!/^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(releasedVersion)
|
|
64
|
+
)
|
|
65
|
+
throw new Error('Invalid release identity')
|
|
66
|
+
const version = kind === 'dev' ? nextDevVersion(releasedVersion) : releasedVersion
|
|
67
|
+
if (!(await provider.isMainAncestor(sourceSha)))
|
|
68
|
+
throw new Error('Requested source is not on main')
|
|
69
|
+
let count = 0
|
|
70
|
+
if (kind === 'dev') {
|
|
71
|
+
const highest = await provider.highestDevCounter(version)
|
|
72
|
+
if (!Number.isSafeInteger(highest) || highest < 0)
|
|
73
|
+
throw new Error('Dev release history is invalid')
|
|
74
|
+
// A retried cut of the newest dev source repairs that release instead of cutting a
|
|
75
|
+
// second tag for the same commit.
|
|
76
|
+
const newest = highest > 0 ? await provider.find(`v${version}-dev.${highest}`) : null
|
|
77
|
+
if (highest > 0 && !newest) throw new Error('Dev release history changed')
|
|
78
|
+
if (
|
|
79
|
+
newest &&
|
|
80
|
+
newest.sourceSha !== sourceSha &&
|
|
81
|
+
!(await provider.isAncestor(newest.sourceSha, sourceSha))
|
|
82
|
+
)
|
|
83
|
+
throw new Error('Dev release source is not newer than the last dev release')
|
|
84
|
+
count = newest?.sourceSha === sourceSha ? highest : highest + 1
|
|
85
|
+
}
|
|
86
|
+
const tag = `v${version}${kind === 'dev' ? `-dev.${count}` : ''}`
|
|
87
|
+
let release = await provider.find(tag)
|
|
88
|
+
if (!release) {
|
|
89
|
+
// Release Please creates every daily; only dev releases are cut here.
|
|
90
|
+
if (kind === 'daily') throw new Error('Release Please has not released this version')
|
|
91
|
+
if (await provider.tagExists(tag)) throw new Error('Existing tag has no trusted release')
|
|
92
|
+
await provider.create({ tag, sourceSha })
|
|
93
|
+
release = await provider.find(tag)
|
|
94
|
+
}
|
|
95
|
+
if (
|
|
96
|
+
!release ||
|
|
97
|
+
release.tag !== tag ||
|
|
98
|
+
release.kind !== kind ||
|
|
99
|
+
(release.draft && !(kind === 'daily' && release.stageableDraft === true)) ||
|
|
100
|
+
!/^[a-f0-9]{40}$/.test(release.sourceSha) ||
|
|
101
|
+
(kind === 'dev' && release.sourceSha !== sourceSha) ||
|
|
102
|
+
!(await provider.isMainAncestor(release.sourceSha))
|
|
103
|
+
)
|
|
104
|
+
throw new Error('Existing release identity mismatch')
|
|
105
|
+
const qualification = await provider.qualification(release)
|
|
106
|
+
if (qualification === 'qualified')
|
|
107
|
+
return { tag, sourceSha: release.sourceSha, status: 'qualified' }
|
|
108
|
+
if (
|
|
109
|
+
qualification !== 'not-qualified' ||
|
|
110
|
+
!(release.prerelease || (release.draft && release.stageableDraft))
|
|
111
|
+
)
|
|
112
|
+
throw new Error('Release qualification is unknown or stable')
|
|
113
|
+
const pending = await provider.pendingBuild(release)
|
|
114
|
+
if (pending === 'pending') return { tag, sourceSha: release.sourceSha, status: 'pending' }
|
|
115
|
+
if (pending !== 'idle') throw new Error('Release build state is unknown')
|
|
116
|
+
const current = await provider.find(tag)
|
|
117
|
+
if (
|
|
118
|
+
!current ||
|
|
119
|
+
current.sourceSha !== release.sourceSha ||
|
|
120
|
+
current.kind !== kind ||
|
|
121
|
+
current.draft !== release.draft ||
|
|
122
|
+
(current.draft ? current.stageableDraft !== true : !current.prerelease) ||
|
|
123
|
+
!(await provider.isMainAncestor(current.sourceSha))
|
|
124
|
+
)
|
|
125
|
+
throw new Error('Release changed before build dispatch')
|
|
126
|
+
if (kind === 'dev') {
|
|
127
|
+
const latest = await provider.highestDevCounter(version)
|
|
128
|
+
if (!Number.isSafeInteger(latest) || latest !== count)
|
|
129
|
+
throw new Error('Dev release history changed before dispatch')
|
|
130
|
+
}
|
|
131
|
+
await provider.dispatch(tag)
|
|
132
|
+
return { tag, sourceSha: release.sourceSha, status: 'dispatched' }
|
|
133
|
+
}
|