@adea-ai/app-framework 0.0.0-stage → 0.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (358) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +30 -0
  3. package/README.md +1009 -2
  4. package/dist/app/application.d.ts +47 -0
  5. package/dist/app/application.js +115 -0
  6. package/dist/app/create-application.d.ts +13 -0
  7. package/dist/app/create-application.js +178 -0
  8. package/dist/app/service-registry.d.ts +44 -0
  9. package/dist/app/service-registry.js +116 -0
  10. package/dist/appearance/appearance-host.d.ts +62 -0
  11. package/dist/appearance/appearance-host.js +115 -0
  12. package/dist/appearance/appearance-preferences.d.ts +106 -0
  13. package/dist/appearance/appearance-preferences.js +175 -0
  14. package/dist/appearance/composition.d.ts +11 -0
  15. package/dist/appearance/composition.js +16 -0
  16. package/dist/appearance/custom-theme-import.d.ts +14 -0
  17. package/dist/appearance/custom-theme-import.js +315 -0
  18. package/dist/appearance/custom-theme-library.d.ts +146 -0
  19. package/dist/appearance/custom-theme-library.js +378 -0
  20. package/dist/appearance/editor.d.ts +20 -0
  21. package/dist/appearance/editor.js +47 -0
  22. package/dist/appearance/theme-file-importer.d.ts +23 -0
  23. package/dist/appearance/theme-file-importer.js +66 -0
  24. package/dist/appearance/theme-record-adapter.d.ts +26 -0
  25. package/dist/appearance/theme-record-adapter.js +64 -0
  26. package/dist/appearance/theme-registry.d.ts +10 -0
  27. package/dist/appearance/theme-registry.js +16 -0
  28. package/dist/appearance/window-surface.d.ts +5 -0
  29. package/dist/appearance/window-surface.js +9 -0
  30. package/dist/ci/toolchain-identity.d.ts +39 -0
  31. package/dist/ci/toolchain-identity.js +196 -0
  32. package/dist/cli/cef-helper-cli.d.ts +2 -0
  33. package/dist/cli/cef-helper-cli.js +18 -0
  34. package/dist/cli/cli-runner.d.ts +8 -0
  35. package/dist/cli/cli-runner.js +23 -0
  36. package/dist/cli/create-application-cli.d.ts +2 -0
  37. package/dist/cli/create-application-cli.js +40 -0
  38. package/dist/cli/electrobun-shortcut-patch-cli.d.ts +2 -0
  39. package/dist/cli/electrobun-shortcut-patch-cli.js +17 -0
  40. package/dist/cli/framework-update-cli.d.ts +2 -0
  41. package/dist/cli/framework-update-cli.js +40 -0
  42. package/dist/cli/release-assets-plan-cli.d.ts +2 -0
  43. package/dist/cli/release-assets-plan-cli.js +14 -0
  44. package/dist/cli/release-cut-cli.d.ts +2 -0
  45. package/dist/cli/release-cut-cli.js +27 -0
  46. package/dist/cli/release-descriptor-staging-cli.d.ts +2 -0
  47. package/dist/cli/release-descriptor-staging-cli.js +45 -0
  48. package/dist/cli/release-finalize-cli.d.ts +1 -0
  49. package/dist/cli/release-finalize-cli.js +30 -0
  50. package/dist/cli/release-promote-cli.d.ts +2 -0
  51. package/dist/cli/release-promote-cli.js +32 -0
  52. package/dist/cli/release-publish-cli.d.ts +2 -0
  53. package/dist/cli/release-publish-cli.js +48 -0
  54. package/dist/cli/release-sign-cli.d.ts +2 -0
  55. package/dist/cli/release-sign-cli.js +13 -0
  56. package/dist/cli/release-step-cli.d.ts +2 -0
  57. package/dist/cli/release-step-cli.js +44 -0
  58. package/dist/cli/toolchain-identity-cli.d.ts +2 -0
  59. package/dist/cli/toolchain-identity-cli.js +10 -0
  60. package/dist/cli/update-helper-cli.d.ts +1 -0
  61. package/dist/cli/update-helper-cli.js +10 -0
  62. package/dist/cli/windows-runtime-patch-cli.d.ts +2 -0
  63. package/dist/cli/windows-runtime-patch-cli.js +17 -0
  64. package/dist/desktop/application-command-client.d.ts +15 -0
  65. package/dist/desktop/application-command-client.js +21 -0
  66. package/dist/desktop/channel-handshake.d.ts +32 -0
  67. package/dist/desktop/channel-handshake.js +111 -0
  68. package/dist/desktop/channel-proof.d.ts +43 -0
  69. package/dist/desktop/channel-proof.js +85 -0
  70. package/dist/desktop/client-assets.d.ts +7 -0
  71. package/dist/desktop/client-assets.js +59 -0
  72. package/dist/desktop/desktop-client.d.ts +23 -0
  73. package/dist/desktop/desktop-client.js +231 -0
  74. package/dist/desktop/desktop-gateway.d.ts +18 -0
  75. package/dist/desktop/desktop-gateway.js +146 -0
  76. package/dist/desktop/desktop-host.d.ts +48 -0
  77. package/dist/desktop/desktop-host.js +208 -0
  78. package/dist/desktop/desktop-stream.d.ts +36 -0
  79. package/dist/desktop/desktop-stream.js +231 -0
  80. package/dist/desktop/loopback-policy.d.ts +19 -0
  81. package/dist/desktop/loopback-policy.js +23 -0
  82. package/dist/desktop/open-url-channel.d.ts +15 -0
  83. package/dist/desktop/open-url-channel.js +55 -0
  84. package/dist/desktop/string-policy.d.ts +2 -0
  85. package/dist/desktop/string-policy.js +11 -0
  86. package/dist/framework-source.json +1 -0
  87. package/dist/installer/archive-entry.d.ts +6 -0
  88. package/dist/installer/archive-entry.js +14 -0
  89. package/dist/installer/command-artifact.d.ts +47 -0
  90. package/dist/installer/command-artifact.js +261 -0
  91. package/dist/installer/command-qualification-command.d.ts +12 -0
  92. package/dist/installer/command-qualification-command.js +71 -0
  93. package/dist/installer/hosted-runner.d.ts +4 -0
  94. package/dist/installer/hosted-runner.js +10 -0
  95. package/dist/installer/installed-payload.d.ts +29 -0
  96. package/dist/installer/installed-payload.js +312 -0
  97. package/dist/installer/installer-ci-bootstrap.d.ts +26 -0
  98. package/dist/installer/installer-ci-bootstrap.js +160 -0
  99. package/dist/installer/installer-ci-preflight.d.ts +1 -0
  100. package/dist/installer/installer-ci-preflight.js +49 -0
  101. package/dist/installer/installer-ci-worker.d.ts +1 -0
  102. package/dist/installer/installer-ci-worker.js +105 -0
  103. package/dist/installer/installer-extraction.d.ts +14 -0
  104. package/dist/installer/installer-extraction.js +289 -0
  105. package/dist/installer/installer-fetch-guard.d.ts +15 -0
  106. package/dist/installer/installer-fetch-guard.js +50 -0
  107. package/dist/installer/installer-identity.d.ts +23 -0
  108. package/dist/installer/installer-identity.js +286 -0
  109. package/dist/installer/installer-layout.d.ts +21 -0
  110. package/dist/installer/installer-layout.js +89 -0
  111. package/dist/installer/installer-observation.d.ts +64 -0
  112. package/dist/installer/installer-observation.js +473 -0
  113. package/dist/installer/installer-process-cleanup.d.ts +18 -0
  114. package/dist/installer/installer-process-cleanup.js +158 -0
  115. package/dist/installer/installer-qualification-command.d.ts +11 -0
  116. package/dist/installer/installer-qualification-command.js +71 -0
  117. package/dist/installer/installer-renderer-evidence.d.ts +43 -0
  118. package/dist/installer/installer-renderer-evidence.js +136 -0
  119. package/dist/installer/installer-upgrade-command.d.ts +37 -0
  120. package/dist/installer/installer-upgrade-command.js +172 -0
  121. package/dist/installer/installer-worker-guard.d.ts +21 -0
  122. package/dist/installer/installer-worker-guard.js +72 -0
  123. package/dist/installer/native-executable.d.ts +5 -0
  124. package/dist/installer/native-executable.js +21 -0
  125. package/dist/installer/upgrade-asset-download.d.ts +13 -0
  126. package/dist/installer/upgrade-asset-download.js +41 -0
  127. package/dist/installer/write-all.d.ts +6 -0
  128. package/dist/installer/write-all.js +11 -0
  129. package/dist/native/app-bundle.d.ts +28 -0
  130. package/dist/native/app-bundle.js +60 -0
  131. package/dist/native/cef-helper.d.ts +28 -0
  132. package/dist/native/cef-helper.js +402 -0
  133. package/dist/native/desktop-build-hook.d.ts +7 -0
  134. package/dist/native/desktop-build-hook.js +20 -0
  135. package/dist/native/electrobun-source-patch.d.ts +25 -0
  136. package/dist/native/electrobun-source-patch.js +93 -0
  137. package/dist/native/linux-cef-links.d.ts +2 -0
  138. package/dist/native/linux-cef-links.js +15 -0
  139. package/dist/native/native-secret-store.d.ts +27 -0
  140. package/dist/native/native-secret-store.js +70 -0
  141. package/dist/native/native-utilities.d.ts +24 -0
  142. package/dist/native/native-utilities.js +85 -0
  143. package/dist/native/partitioned-window.d.ts +34 -0
  144. package/dist/native/partitioned-window.js +44 -0
  145. package/dist/native/renderer-profile.d.ts +53 -0
  146. package/dist/native/renderer-profile.js +30 -0
  147. package/dist/native/secure-window.d.ts +38 -0
  148. package/dist/native/secure-window.js +77 -0
  149. package/dist/native/sidecar-services.d.ts +23 -0
  150. package/dist/native/sidecar-services.js +46 -0
  151. package/dist/native/sidecar.d.ts +81 -0
  152. package/dist/native/sidecar.js +250 -0
  153. package/dist/native/window-bootstrap.d.ts +24 -0
  154. package/dist/native/window-bootstrap.js +63 -0
  155. package/dist/native/window-options.d.ts +32 -0
  156. package/dist/native/window-options.js +23 -0
  157. package/dist/native/windows-build-hook-internal.d.ts +2 -0
  158. package/dist/native/windows-build-hook-internal.js +32 -0
  159. package/dist/native/windows-build-hook.d.ts +2 -0
  160. package/dist/native/windows-build-hook.js +12 -0
  161. package/dist/native/windows-runtime-patch-internal.d.ts +3 -0
  162. package/dist/native/windows-runtime-patch-internal.js +20 -0
  163. package/dist/native/windows-runtime-patch.d.ts +4 -0
  164. package/dist/native/windows-runtime-patch.js +12 -0
  165. package/dist/release/feed-release-cut.d.ts +23 -0
  166. package/dist/release/feed-release-cut.js +93 -0
  167. package/dist/release/feed-state.d.ts +25 -0
  168. package/dist/release/feed-state.js +81 -0
  169. package/dist/release/framework-package-publish.d.ts +21 -0
  170. package/dist/release/framework-package-publish.js +127 -0
  171. package/dist/release/framework-update.d.ts +30 -0
  172. package/dist/release/framework-update.js +139 -0
  173. package/dist/release/github-cli.d.ts +6 -0
  174. package/dist/release/github-cli.js +16 -0
  175. package/dist/release/github-release-assets.d.ts +3 -0
  176. package/dist/release/github-release-assets.js +24 -0
  177. package/dist/release/github-release-cut.d.ts +14 -0
  178. package/dist/release/github-release-cut.js +174 -0
  179. package/dist/release/github-release-lookup.d.ts +7 -0
  180. package/dist/release/github-release-lookup.js +29 -0
  181. package/dist/release/github-release-promotion.d.ts +10 -0
  182. package/dist/release/github-release-promotion.js +78 -0
  183. package/dist/release/github-release-provenance.d.ts +9 -0
  184. package/dist/release/github-release-provenance.js +27 -0
  185. package/dist/release/github-release-publisher.d.ts +9 -0
  186. package/dist/release/github-release-publisher.js +63 -0
  187. package/dist/release/github-release-qualification.d.ts +12 -0
  188. package/dist/release/github-release-qualification.js +80 -0
  189. package/dist/release/local-provenance.d.ts +24 -0
  190. package/dist/release/local-provenance.js +72 -0
  191. package/dist/release/local-release.d.ts +133 -0
  192. package/dist/release/local-release.js +387 -0
  193. package/dist/release/macos-dmg.d.ts +22 -0
  194. package/dist/release/macos-dmg.js +91 -0
  195. package/dist/release/release-artifact.d.ts +6 -0
  196. package/dist/release/release-artifact.js +38 -0
  197. package/dist/release/release-assets-plan.d.ts +14 -0
  198. package/dist/release/release-assets-plan.js +65 -0
  199. package/dist/release/release-config.d.ts +76 -0
  200. package/dist/release/release-config.js +180 -0
  201. package/dist/release/release-cut-command.d.ts +13 -0
  202. package/dist/release/release-cut-command.js +39 -0
  203. package/dist/release/release-cut.d.ts +54 -0
  204. package/dist/release/release-cut.js +76 -0
  205. package/dist/release/release-descriptor-staging.d.ts +34 -0
  206. package/dist/release/release-descriptor-staging.js +147 -0
  207. package/dist/release/release-finalize.d.ts +16 -0
  208. package/dist/release/release-finalize.js +104 -0
  209. package/dist/release/release-promotion-command.d.ts +12 -0
  210. package/dist/release/release-promotion-command.js +28 -0
  211. package/dist/release/release-promotion.d.ts +29 -0
  212. package/dist/release/release-promotion.js +57 -0
  213. package/dist/release/release-publication.d.ts +33 -0
  214. package/dist/release/release-publication.js +138 -0
  215. package/dist/release/release-publish-command.d.ts +7 -0
  216. package/dist/release/release-publish-command.js +91 -0
  217. package/dist/release/release-qualification.d.ts +106 -0
  218. package/dist/release/release-qualification.js +135 -0
  219. package/dist/release/release-staging.d.ts +9 -0
  220. package/dist/release/release-staging.js +61 -0
  221. package/dist/release/release-steps.d.ts +38 -0
  222. package/dist/release/release-steps.js +147 -0
  223. package/dist/release/retained-release-build.d.ts +19 -0
  224. package/dist/release/retained-release-build.js +122 -0
  225. package/dist/shell/app-shell.d.ts +61 -0
  226. package/dist/shell/app-shell.js +306 -0
  227. package/dist/shell/app-utilities.d.ts +122 -0
  228. package/dist/shell/app-utilities.js +334 -0
  229. package/dist/shell/application-menu-commands.d.ts +5 -0
  230. package/dist/shell/application-menu-commands.js +11 -0
  231. package/dist/shell/application-menu.d.ts +61 -0
  232. package/dist/shell/application-menu.js +208 -0
  233. package/dist/shell/help-shortcuts.d.ts +12 -0
  234. package/dist/shell/help-shortcuts.js +22 -0
  235. package/dist/shell/navigation-drawer.d.ts +12 -0
  236. package/dist/shell/navigation-drawer.js +42 -0
  237. package/dist/shell/settings-sections.d.ts +31 -0
  238. package/dist/shell/settings-sections.js +50 -0
  239. package/dist/shell/shortcut-platform.d.ts +17 -0
  240. package/dist/shell/shortcut-platform.js +25 -0
  241. package/dist/update-helper.bundle.js +260 -0
  242. package/dist/updates/channel-update-manager.d.ts +46 -0
  243. package/dist/updates/channel-update-manager.js +114 -0
  244. package/dist/updates/desktop-updater.d.ts +104 -0
  245. package/dist/updates/desktop-updater.js +345 -0
  246. package/dist/updates/release-feed.d.ts +61 -0
  247. package/dist/updates/release-feed.js +111 -0
  248. package/dist/updates/release-location.d.ts +9 -0
  249. package/dist/updates/release-location.js +80 -0
  250. package/dist/updates/release-version.d.ts +12 -0
  251. package/dist/updates/release-version.js +43 -0
  252. package/dist/updates/signed-release.d.ts +63 -0
  253. package/dist/updates/signed-release.js +162 -0
  254. package/dist/updates/stable-file.d.ts +10 -0
  255. package/dist/updates/stable-file.js +22 -0
  256. package/dist/updates/update-adapter.d.ts +57 -0
  257. package/dist/updates/update-adapter.js +72 -0
  258. package/dist/updates/update-arm.d.ts +24 -0
  259. package/dist/updates/update-arm.js +95 -0
  260. package/dist/updates/update-channel-store.d.ts +8 -0
  261. package/dist/updates/update-channel-store.js +72 -0
  262. package/dist/updates/update-discovery.d.ts +13 -0
  263. package/dist/updates/update-discovery.js +56 -0
  264. package/dist/updates/update-download.d.ts +14 -0
  265. package/dist/updates/update-download.js +67 -0
  266. package/dist/updates/update-exclusive-rename.d.ts +2 -0
  267. package/dist/updates/update-exclusive-rename.js +52 -0
  268. package/dist/updates/update-extraction.d.ts +18 -0
  269. package/dist/updates/update-extraction.js +183 -0
  270. package/dist/updates/update-handoff-plan.d.ts +22 -0
  271. package/dist/updates/update-handoff-plan.js +28 -0
  272. package/dist/updates/update-helper.d.ts +24 -0
  273. package/dist/updates/update-helper.js +56 -0
  274. package/dist/updates/update-launch.d.ts +5 -0
  275. package/dist/updates/update-launch.js +27 -0
  276. package/dist/updates/update-manager.d.ts +40 -0
  277. package/dist/updates/update-manager.js +83 -0
  278. package/dist/updates/update-process-fence.d.ts +10 -0
  279. package/dist/updates/update-process-fence.js +114 -0
  280. package/dist/updates/update-resume.d.ts +13 -0
  281. package/dist/updates/update-resume.js +34 -0
  282. package/dist/updates/update-shutdown.d.ts +15 -0
  283. package/dist/updates/update-shutdown.js +29 -0
  284. package/dist/updates/update-state.d.ts +30 -0
  285. package/dist/updates/update-state.js +18 -0
  286. package/dist/updates/update-swap-stage.d.ts +27 -0
  287. package/dist/updates/update-swap-stage.js +58 -0
  288. package/dist/updates/update-swap.d.ts +10 -0
  289. package/dist/updates/update-swap.js +30 -0
  290. package/dist/views/app-about.d.ts +22 -0
  291. package/dist/views/app-about.js +43 -0
  292. package/dist/views/app-appearance.d.ts +11 -0
  293. package/dist/views/app-appearance.js +42 -0
  294. package/dist/views/app-help.d.ts +17 -0
  295. package/dist/views/app-help.js +42 -0
  296. package/dist/views/app-settings.d.ts +26 -0
  297. package/dist/views/app-settings.js +97 -0
  298. package/dist/views/appearance-surface.d.ts +9 -0
  299. package/dist/views/appearance-surface.js +334 -0
  300. package/dist/views/update-surface.d.ts +34 -0
  301. package/dist/views/update-surface.js +64 -0
  302. package/package.json +374 -4
  303. package/src/app/application.tsx +138 -0
  304. package/src/appearance/appearance-host.tsx +205 -0
  305. package/src/appearance/appearance-preferences.ts +287 -0
  306. package/src/appearance/composition.ts +29 -0
  307. package/src/appearance/custom-theme-import.ts +424 -0
  308. package/src/appearance/custom-theme-library.ts +600 -0
  309. package/src/appearance/editor.ts +94 -0
  310. package/src/appearance/theme-file-importer.ts +103 -0
  311. package/src/appearance/theme-record-adapter.ts +106 -0
  312. package/src/appearance/theme-registry.ts +20 -0
  313. package/src/appearance/window-surface.ts +18 -0
  314. package/src/desktop/client-assets.ts +75 -0
  315. package/src/native/electrobun-cef-main-frame-bridges.patch +63 -0
  316. package/src/native/electrobun-windows-shortcut-com.patch +923 -0
  317. package/src/native/renderer-profile.ts +27 -0
  318. package/src/native/window-options.ts +24 -0
  319. package/src/shell/app-shell.tsx +294 -0
  320. package/src/shell/app-utilities.tsx +437 -0
  321. package/src/shell/help-shortcuts.ts +24 -0
  322. package/src/shell/navigation-drawer.tsx +36 -0
  323. package/src/shell/settings-sections.ts +74 -0
  324. package/src/shell/shortcut-platform.ts +35 -0
  325. package/src/updates/release-version.ts +57 -0
  326. package/src/updates/update-adapter.ts +129 -0
  327. package/src/updates/update-state.ts +34 -0
  328. package/src/views/app-about.tsx +44 -0
  329. package/src/views/app-appearance.tsx +32 -0
  330. package/src/views/app-help.tsx +43 -0
  331. package/src/views/app-settings.tsx +88 -0
  332. package/src/views/appearance-surface.tsx +427 -0
  333. package/src/views/update-surface.tsx +85 -0
  334. package/templates/application/.gitattributes +1 -0
  335. package/templates/application/.github/workflows/release-assets.yml +29 -0
  336. package/templates/application/.github/workflows/release-finalize.yml +29 -0
  337. package/templates/application/.github/workflows/release-please.yml +19 -0
  338. package/templates/application/.github/workflows/release.yml +29 -0
  339. package/templates/application/.github/workflows/validation.yml +28 -0
  340. package/templates/application/.oxfmtrc.json +6 -0
  341. package/templates/application/.oxlintrc.json +48 -0
  342. package/templates/application/.release-please-manifest.json +3 -0
  343. package/templates/application/README.md +47 -0
  344. package/templates/application/electrobun.config.ts +22 -0
  345. package/templates/application/release-please-config.json +12 -0
  346. package/templates/application/scripts/app-version.ts +9 -0
  347. package/templates/application/scripts/build-desktop.ts +34 -0
  348. package/templates/application/scripts/secure-build.ts +1 -0
  349. package/templates/application/scripts/stage-release.ts +21 -0
  350. package/templates/application/src/bun/index.ts +80 -0
  351. package/templates/application/src/electrobun.d.ts +27 -0
  352. package/templates/application/src/web/index.html +12 -0
  353. package/templates/application/src/web/main.tsx +97 -0
  354. package/templates/application/src/web/public/icon.svg +1 -0
  355. package/templates/application/src/web/style.css +3 -0
  356. package/templates/application/tests/app-config.test.ts +9 -0
  357. package/templates/application/tsconfig.json +15 -0
  358. package/templates/application/vite.config.ts +10 -0
@@ -0,0 +1,39 @@
1
+ /** The marker written into commands when the toolchain could not be identified. It never matches. */
2
+ export declare const UNIDENTIFIED = "unidentified";
3
+ type Binary = {
4
+ version: string;
5
+ sha256: string;
6
+ };
7
+ export type ToolchainIdentity = {
8
+ platform: string;
9
+ libc: string;
10
+ node: Binary;
11
+ bun: Binary;
12
+ };
13
+ /** The executable `name` resolves to on `searchPath`, never a CWD lookup. */
14
+ export declare function onPath(name: string, searchPath: string, platform?: NodeJS.Platform): string | undefined;
15
+ /**
16
+ * The real executable behind `name` on `searchPath`. A launcher (Vite+ may
17
+ * prepend one only when a task starts) is followed to the binary it runs.
18
+ */
19
+ export declare function runtimeExecutable(name: string, searchPath?: string): string;
20
+ /**
21
+ * The identity of the `node` and `bun` found on `searchPath`, and of the
22
+ * platform. Throws when it cannot be established.
23
+ */
24
+ export declare function identity({ root, searchPath, }?: {
25
+ root?: string;
26
+ searchPath?: string;
27
+ }): ToolchainIdentity;
28
+ /** A short, shell-safe id that goes into command text. */
29
+ export declare function idOf(found: ToolchainIdentity): string;
30
+ /**
31
+ * The id the tasks of the invocation that is loading `vite.config.ts` are
32
+ * expected to run on. `vp` runs tasks with `node_modules/.bin` first and the
33
+ * package-manager `bun` ahead of the shell's, and gives the config process the
34
+ * latter already, so the workspace `.bin` is the one directory added here.
35
+ */
36
+ export declare function expectedId(root?: string): string;
37
+ /** Exit status for `--expect <id>`: 0 only when the tasks run on the toolchain their keys name. */
38
+ export declare function verifyToolchain(expected: string, root?: string): number;
39
+ export {};
@@ -0,0 +1,196 @@
1
+ import { delimiter, join } from "node:path";
2
+ import { accessSync, closeSync, constants, mkdirSync, openSync, readFileSync, readSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
3
+ import { execFileSync } from "node:child_process";
4
+ import { createHash } from "node:crypto";
5
+ // src/ci/toolchain-identity.ts
6
+ /**
7
+ * Identifies the toolchain cached `vp` tasks run on, so every cache key covers
8
+ * it without anyone setting a label.
9
+ *
10
+ * Vite Task fingerprints a task's command text, declared environment variables
11
+ * and the files it reads, but not the `node` or `bun` binary or the platform.
12
+ * An app's `vite.config.ts` calls `expectedId()` every time `vp` loads it and
13
+ * writes the result into the text of each cached command, so a different Node,
14
+ * Bun or platform is a different key. The id lives in the invocation's own task
15
+ * graph, not in a file, so two `vp` invocations in one checkout with different
16
+ * toolchains cannot see each other's.
17
+ *
18
+ * The config process cannot be trusted to see what the tasks will, so every
19
+ * invocation also runs an uncached task first
20
+ * (`adea-toolchain-identity --expect <id>`) with the PATH the tasks really get.
21
+ * It recomputes the id and exits non-zero unless it equals the one written into
22
+ * the commands; the dependent tasks then do not run and nothing is read from or
23
+ * stored in the cache.
24
+ *
25
+ * The id holds each binary's version and a hash of its bytes, the platform and
26
+ * the libc, never a path: the same bytes at another path (another checkout, a CI
27
+ * runner) keep their entries.
28
+ */
29
+ /** The marker written into commands when the toolchain could not be identified. It never matches. */
30
+ var UNIDENTIFIED = "unidentified";
31
+ var errorCode = (error) => error?.code;
32
+ var message = (error) => error instanceof Error ? error.message : String(error);
33
+ /** The executable `name` resolves to on `searchPath`, never a CWD lookup. */
34
+ function onPath(name, searchPath, platform = process.platform) {
35
+ for (const dir of searchPath.split(delimiter)) {
36
+ if (!dir) continue;
37
+ const executable = (filename) => {
38
+ const candidate = join(dir, filename);
39
+ try {
40
+ accessSync(candidate, constants.X_OK);
41
+ if (statSync(candidate).isFile()) return realpathSync(candidate);
42
+ } catch {}
43
+ };
44
+ const exact = executable(name);
45
+ if (exact) return exact;
46
+ if (platform === "win32") {
47
+ for (const ext of [
48
+ ".cmd",
49
+ ".bat",
50
+ ".com"
51
+ ]) try {
52
+ if (statSync(join(dir, name + ext)).isFile()) throw new Error(`Cannot identify Windows launcher for ${name}`);
53
+ } catch (error) {
54
+ if (errorCode(error) !== "ENOENT" && errorCode(error) !== "ENOTDIR") throw error;
55
+ }
56
+ const native = executable(`${name}.exe`);
57
+ if (native) return native;
58
+ }
59
+ }
60
+ }
61
+ var memoFile = (root) => join(root, "node_modules", ".cache", "orch-toolchain-memo.json");
62
+ function readMemo(root) {
63
+ try {
64
+ return JSON.parse(readFileSync(memoFile(root), "utf8"));
65
+ } catch {
66
+ return {};
67
+ }
68
+ }
69
+ /** sha256 of a file, remembered by path, size and modification time (a hash cache, not an identity). */
70
+ function sha256(file, memo, root) {
71
+ const before = statSync(file);
72
+ const key = `${file}:${before.size}:${before.mtimeMs}`;
73
+ if (memo[key]) return memo[key];
74
+ const hash = createHash("sha256");
75
+ const buffer = Buffer.allocUnsafe(1 << 20);
76
+ const fd = openSync(file, "r");
77
+ try {
78
+ for (;;) {
79
+ const read = readSync(fd, buffer, 0, buffer.length, null);
80
+ if (read === 0) break;
81
+ hash.update(buffer.subarray(0, read));
82
+ }
83
+ } finally {
84
+ closeSync(fd);
85
+ }
86
+ const digest = hash.digest("hex");
87
+ const after = statSync(file);
88
+ if (after.size === before.size && after.mtimeMs === before.mtimeMs) {
89
+ for (const old of Object.keys(memo)) if (old.startsWith(`${file}:`)) delete memo[old];
90
+ memo[key] = digest;
91
+ try {
92
+ mkdirSync(join(root, "node_modules", ".cache"), { recursive: true });
93
+ const staged = `${memoFile(root)}.${process.pid}`;
94
+ writeFileSync(staged, JSON.stringify(memo));
95
+ renameSync(staged, memoFile(root));
96
+ } catch {}
97
+ }
98
+ return digest;
99
+ }
100
+ /**
101
+ * The real executable behind `name` on `searchPath`. A launcher (Vite+ may
102
+ * prepend one only when a task starts) is followed to the binary it runs.
103
+ */
104
+ function runtimeExecutable(name, searchPath = process.env.PATH ?? "") {
105
+ const file = onPath(name, searchPath);
106
+ if (!file) throw new Error(`\`${name}\` is not on PATH, so the toolchain cannot be identified`);
107
+ try {
108
+ const executable = execFileSync(file, ["-p", "process.execPath"], {
109
+ encoding: "utf8",
110
+ ...searchPath === process.env.PATH ? {} : { env: {
111
+ ...process.env,
112
+ PATH: searchPath
113
+ } }
114
+ }).trim();
115
+ if (!executable || !statSync(executable).isFile()) throw new Error("invalid executable path");
116
+ return realpathSync(executable);
117
+ } catch (error) {
118
+ throw new Error(`\`${name}\` executable probe failed: ${message(error)}`, { cause: error });
119
+ }
120
+ }
121
+ function describe(name, searchPath, memo, root) {
122
+ const file = onPath(name, searchPath);
123
+ if (!file) throw new Error(`\`${name}\` is not on PATH, so the toolchain cannot be identified`);
124
+ let version;
125
+ try {
126
+ version = execFileSync(file, ["--version"], { encoding: "utf8" }).trim();
127
+ } catch (error) {
128
+ throw new Error(`\`${name} --version\` failed: ${message(error)}`, { cause: error });
129
+ }
130
+ if (!version) throw new Error(`\`${name} --version\` printed nothing`);
131
+ return {
132
+ version,
133
+ sha256: sha256(runtimeExecutable(name, searchPath), memo, root)
134
+ };
135
+ }
136
+ /**
137
+ * The identity of the `node` and `bun` found on `searchPath`, and of the
138
+ * platform. Throws when it cannot be established.
139
+ */
140
+ function identity({ root = process.cwd(), searchPath = process.env.PATH ?? "" } = {}) {
141
+ const memo = readMemo(root);
142
+ const libc = (process.report?.getReport?.())?.header?.glibcVersionRuntime;
143
+ return {
144
+ platform: `${process.platform}-${process.arch}`,
145
+ libc: libc ? `glibc${libc}` : process.platform === "linux" ? "non-glibc" : "na",
146
+ node: describe("node", searchPath, memo, root),
147
+ bun: describe("bun", searchPath, memo, root)
148
+ };
149
+ }
150
+ var clean = (text) => text.replace(/^v/, "").replace(/[^A-Za-z0-9.]+/g, "_");
151
+ /** A short, shell-safe id that goes into command text. */
152
+ function idOf(found) {
153
+ return [
154
+ found.platform,
155
+ found.libc,
156
+ `node${clean(found.node.version)}-${found.node.sha256.slice(0, 12)}`,
157
+ `bun${clean(found.bun.version)}-${found.bun.sha256.slice(0, 12)}`
158
+ ].join(".");
159
+ }
160
+ /**
161
+ * The id the tasks of the invocation that is loading `vite.config.ts` are
162
+ * expected to run on. `vp` runs tasks with `node_modules/.bin` first and the
163
+ * package-manager `bun` ahead of the shell's, and gives the config process the
164
+ * latter already, so the workspace `.bin` is the one directory added here.
165
+ */
166
+ function expectedId(root = process.cwd()) {
167
+ try {
168
+ return idOf(identity({
169
+ root,
170
+ searchPath: [join(root, "node_modules", ".bin"), process.env.PATH ?? ""].join(delimiter)
171
+ }));
172
+ } catch {
173
+ return UNIDENTIFIED;
174
+ }
175
+ }
176
+ /** Exit status for `--expect <id>`: 0 only when the tasks run on the toolchain their keys name. */
177
+ function verifyToolchain(expected, root = process.cwd()) {
178
+ let actual;
179
+ try {
180
+ actual = idOf(identity({ root }));
181
+ } catch (error) {
182
+ console.error(`toolchain-identity: ${message(error)}`);
183
+ return 1;
184
+ }
185
+ if (expected === "unidentified") {
186
+ console.error("toolchain-identity: the toolchain could not be identified when the tasks were loaded");
187
+ return 1;
188
+ }
189
+ if (actual !== expected) {
190
+ console.error(`toolchain-identity: the tasks run on ${actual}, but their cache keys were written for ${expected}`);
191
+ return 1;
192
+ }
193
+ console.log(`toolchain ${actual}`);
194
+ return 0;
195
+ }
196
+ export { UNIDENTIFIED, expectedId, idOf, identity, onPath, runtimeExecutable, verifyToolchain };
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env bun
2
+ import { cefHelperCacheKey, cefHelperFailure, ensurePatchedCefHelper } from "../native/cef-helper.js";
3
+ import { runCli } from "./cli-runner.js";
4
+ // src/cli/cef-helper-cli.ts
5
+ await runCli((error) => `Unable to prepare the patched CEF helper: ${cefHelperFailure(error)}`, async () => {
6
+ const [command, ...extra] = process.argv.slice(2);
7
+ if (extra.length || command !== "key" && command !== "build") throw new Error("Unexpected arguments");
8
+ const os = {
9
+ darwin: "macos",
10
+ linux: "linux",
11
+ win32: "win"
12
+ }[process.platform] ?? "";
13
+ if (command === "key") process.stdout.write(`${cefHelperCacheKey(os, process.arch)}\n`);
14
+ else {
15
+ await ensurePatchedCefHelper(process.env, os, process.arch);
16
+ process.stdout.write("Patched CEF helper is cached\n");
17
+ }
18
+ });
@@ -0,0 +1,8 @@
1
+ /** Run a command-line entry point. Any failure prints `failure` and sets exit code 1. A
2
+ * string never shows the error itself, which may carry paths or key material; pass a
3
+ * function only for commands whose errors are safe to print. */
4
+ export declare function runCli(failure: string | ((error: unknown) => string), main: () => unknown, options?: {
5
+ requireGitHubActions?: boolean;
6
+ }): Promise<void>;
7
+ /** Parse a JSON file that is a regular file, not a link, of 1 to `maxBytes` bytes. */
8
+ export declare function readJsonFile(path: string, maxBytes: number): Promise<unknown>;
@@ -0,0 +1,23 @@
1
+ import { lstat, readFile } from "node:fs/promises";
2
+ // src/cli/cli-runner.ts
3
+ /** Run a command-line entry point. Any failure prints `failure` and sets exit code 1. A
4
+ * string never shows the error itself, which may carry paths or key material; pass a
5
+ * function only for commands whose errors are safe to print. */
6
+ async function runCli(failure, main, options = {}) {
7
+ try {
8
+ if (options.requireGitHubActions && process.env.GITHUB_ACTIONS !== "true") throw new Error("Invalid workflow invocation");
9
+ await main();
10
+ } catch (error) {
11
+ process.stderr.write(`${typeof failure === "string" ? failure : failure(error)}\n`);
12
+ process.exitCode = 1;
13
+ }
14
+ }
15
+ /** Parse a JSON file that is a regular file, not a link, of 1 to `maxBytes` bytes. */
16
+ async function readJsonFile(path, maxBytes) {
17
+ const info = await lstat(path);
18
+ if (!info.isFile() || info.isSymbolicLink() || info.size < 1 || info.size > maxBytes) throw new Error("Invalid configuration file");
19
+ const bytes = await readFile(path);
20
+ if (bytes.length !== info.size) throw new Error("Configuration file changed");
21
+ return JSON.parse(bytes.toString("utf8"));
22
+ }
23
+ export { readJsonFile, runCli };
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env bun
2
+ import { createApplication } from "../app/create-application.js";
3
+ import { runCli } from "./cli-runner.js";
4
+ // src/cli/create-application-cli.ts
5
+ var usage = "Usage: create-adea-app --directory PATH --slug SLUG --name NAME --identifier REVERSE_DNS --source-url HTTPS_URL --framework SPECIFIER [--renderer native|cef]";
6
+ var allowed = /* @__PURE__ */ new Set([
7
+ "directory",
8
+ "slug",
9
+ "name",
10
+ "identifier",
11
+ "source-url",
12
+ "framework",
13
+ "renderer"
14
+ ]);
15
+ await runCli((error) => error instanceof Error ? error.message : "Could not create application", async () => {
16
+ const args = process.argv.slice(2);
17
+ if (args.length === 1 && args[0] === "--help") {
18
+ console.log(usage);
19
+ process.exit(0);
20
+ }
21
+ const values = {};
22
+ for (let i = 0; i < args.length; i += 2) {
23
+ const key = args[i]?.startsWith("--") ? args[i].slice(2) : "";
24
+ const value = args[i + 1];
25
+ if (!allowed.has(key) || values[key] !== void 0 || !value || value.startsWith("--")) throw new Error(usage);
26
+ values[key] = value;
27
+ }
28
+ const { directory, slug, name, identifier, "source-url": sourceUrl, framework, renderer } = values;
29
+ if (!directory || !slug || !name || !identifier || !sourceUrl || !framework || renderer && renderer !== "native" && renderer !== "cef") throw new Error(usage);
30
+ const result = await createApplication({
31
+ directory,
32
+ slug,
33
+ name,
34
+ identifier,
35
+ sourceUrl,
36
+ frameworkSpecifier: framework,
37
+ renderer
38
+ });
39
+ console.log(`Created application at ${result.directory}`);
40
+ });
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env bun
2
+ import { PINNED_SHORTCUT_PATCH, SHORTCUT_PATCH_PATH, applyElectrobunPatch } from "../native/electrobun-source-patch.js";
3
+ import { runCli } from "./cli-runner.js";
4
+ import { resolve } from "node:path";
5
+ import { execFileSync } from "node:child_process";
6
+ // src/cli/electrobun-shortcut-patch-cli.ts
7
+ await runCli((error) => `Unable to apply the pinned Electrobun shortcut patch: ${error instanceof Error ? error.message : "unknown error"}`, () => {
8
+ const [checkout, ...extra] = process.argv.slice(2);
9
+ if (!checkout || extra.length) throw new Error("Expected an Electrobun checkout");
10
+ const root = resolve(checkout);
11
+ if (execFileSync("git", ["rev-parse", "HEAD"], {
12
+ cwd: root,
13
+ encoding: "utf8"
14
+ }).trim() !== "d06abc9edf0b4e55116129cabbfe17bf89e11791") throw new Error("Unexpected Electrobun commit");
15
+ applyElectrobunPatch(root, SHORTCUT_PATCH_PATH, PINNED_SHORTCUT_PATCH);
16
+ process.stdout.write("Prepared pinned Electrobun extractor with bounded Shell Link shortcuts\n");
17
+ });
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env bun
2
+ import { runCli } from "./cli-runner.js";
3
+ import { applyFrameworkUpdate, resolveFrameworkRelease } from "../release/framework-update.js";
4
+ // src/cli/framework-update-cli.ts
5
+ await runCli((error) => `App-framework update failed; nothing was changed. ${error.message}`, async () => {
6
+ const [requested, ...extra] = process.argv.slice(2);
7
+ if (extra.length) throw new Error("Usage: adea-update-app-framework [version]");
8
+ const release = await resolveFrameworkRelease({
9
+ async registry(path) {
10
+ const response = await fetch(`https://registry.npmjs.org/${path}`, { headers: { accept: "application/json" } });
11
+ if (!response.ok) throw new Error(`npm answered ${response.status} for ${path}`);
12
+ return response.json();
13
+ },
14
+ async download(url) {
15
+ const response = await fetch(url);
16
+ if (!response.ok) throw new Error(`Download answered ${response.status}`);
17
+ return new Uint8Array(await response.arrayBuffer());
18
+ }
19
+ }, requested);
20
+ const root = process.cwd();
21
+ const result = await applyFrameworkUpdate(root, release, {
22
+ async run(command, cwd) {
23
+ return Bun.spawn(command, {
24
+ cwd,
25
+ stdout: "inherit",
26
+ stderr: "inherit"
27
+ }).exited;
28
+ },
29
+ async files(cwd) {
30
+ const listing = Bun.spawnSync([
31
+ "git",
32
+ "ls-files",
33
+ "-z"
34
+ ], { cwd });
35
+ if (listing.exitCode !== 0) throw new Error("git ls-files failed");
36
+ return listing.stdout.toString().split("\0").filter(Boolean);
37
+ }
38
+ });
39
+ process.stdout.write(JSON.stringify(result) + "\n");
40
+ });
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env bun
2
+ import { readJsonFile, runCli } from "./cli-runner.js";
3
+ import { planReleaseAssets } from "../release/release-assets-plan.js";
4
+ // src/cli/release-assets-plan-cli.ts
5
+ await runCli("Unable to plan release assets; check release provenance and the trusted workflow.", async () => {
6
+ const [tag, path, ...extra] = process.argv.slice(2);
7
+ if (!tag || !path || extra.length) throw new Error("Expected release tag and configuration file");
8
+ const config = await readJsonFile(path, 262144);
9
+ console.log(JSON.stringify(await planReleaseAssets({
10
+ env: process.env,
11
+ config,
12
+ tag
13
+ })));
14
+ });
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env bun
2
+ import { readJsonFile, runCli } from "./cli-runner.js";
3
+ import { gitCli } from "../release/local-provenance.js";
4
+ import { runReleaseCutCommand } from "../release/release-cut-command.js";
5
+ import { hostReleasePlatform, runLocalReleaseCut } from "../release/local-release.js";
6
+ // src/cli/release-cut-cli.ts
7
+ var local = process.argv[2] === "--local";
8
+ await runCli("Unable to cut the release; check the trusted workflow or local checkout and release configuration.", async () => {
9
+ const [kind, path, sourceSha, ...extra] = process.argv.slice(local ? 3 : 2);
10
+ if (kind !== "daily" && kind !== "dev" || !path || extra.length || !sourceSha !== !local) throw new Error("Invalid workflow invocation");
11
+ const config = await readJsonFile(path, 65536);
12
+ if (typeof config !== "object" || config === null || typeof config.appName !== "string") throw new Error("Missing app name");
13
+ const result = local ? await runLocalReleaseCut({
14
+ kind,
15
+ config,
16
+ sourceSha,
17
+ platform: hostReleasePlatform(),
18
+ git: gitCli(),
19
+ fetch
20
+ }) : await runReleaseCutCommand({
21
+ env: process.env,
22
+ kind,
23
+ appName: config.appName,
24
+ config
25
+ });
26
+ process.stdout.write(JSON.stringify(result) + "\n");
27
+ }, { requireGitHubActions: !local });
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env bun
2
+ import { readJsonFile, runCli } from "./cli-runner.js";
3
+ import { gitCli } from "../release/local-provenance.js";
4
+ import { stageReleaseDescriptors } from "../release/release-descriptor-staging.js";
5
+ import { hostReleasePlatform, localTagProvenance, stageLocalDescriptors } from "../release/local-release.js";
6
+ import { createPrivateKey } from "node:crypto";
7
+ // src/cli/release-descriptor-staging-cli.ts
8
+ var local = process.argv[2] === "--local";
9
+ await runCli("Unable to stage signed descriptors; check the trusted release, installer receipts and signing configuration.", async () => {
10
+ const [directory, configPath, ...extra] = process.argv.slice(local ? 3 : 2);
11
+ const { RELEASE_TAG: tag, ADEA_RELEASE_SIGNING_KEY: pem, ADEA_RELEASE_SIGNING_KEY_ID: keyId, SOURCE_SHA: sourceSha, RELEASE_RUN_ID: runId } = process.env;
12
+ if (!directory || !configPath || extra.length || !tag || !pem || !keyId) throw new Error("Missing signing context");
13
+ const config = await readJsonFile(configPath, 262144);
14
+ if (!local) {
15
+ const names = await stageReleaseDescriptors({
16
+ env: process.env,
17
+ config,
18
+ directory,
19
+ tag,
20
+ keyId,
21
+ privateKey: createPrivateKey(pem)
22
+ });
23
+ console.log(JSON.stringify(names));
24
+ return;
25
+ }
26
+ if (!sourceSha || !runId) throw new Error("Missing local release identity");
27
+ const { repository } = await localTagProvenance({
28
+ config,
29
+ tag,
30
+ sourceSha,
31
+ git: gitCli()
32
+ });
33
+ const names = await stageLocalDescriptors({
34
+ config,
35
+ directory,
36
+ tag,
37
+ sourceSha,
38
+ repository,
39
+ runId,
40
+ platform: hostReleasePlatform(),
41
+ keyId,
42
+ privateKey: createPrivateKey(pem)
43
+ });
44
+ console.log(JSON.stringify(names));
45
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ import { gitCli, originRepository } from "../release/local-provenance.js";
2
+ import { verifyLocalRelease } from "../release/local-release.js";
3
+ import { finalizeReleasePleaseDraft, parseFinalizationEvent } from "../release/release-finalize.js";
4
+ import { readFile } from "node:fs/promises";
5
+ // src/cli/release-finalize-cli.ts
6
+ if (process.argv[2] === "--local") {
7
+ const [configPath, tag, ...extra] = process.argv.slice(3);
8
+ if (!configPath || !tag || extra.length) throw new Error("Expected release configuration and tag");
9
+ const config = JSON.parse(await readFile(configPath, "utf8"));
10
+ const result = await verifyLocalRelease({
11
+ config,
12
+ tag,
13
+ repository: await originRepository(gitCli()),
14
+ fetch
15
+ });
16
+ console.log(JSON.stringify(result));
17
+ } else {
18
+ const configPath = process.argv[2];
19
+ if (!configPath || process.argv.length !== 3 || !process.env.GITHUB_EVENT_PATH) throw new Error("Expected release configuration and workflow event");
20
+ const config = JSON.parse(await readFile(configPath, "utf8"));
21
+ if (typeof config !== "object" || config === null || Array.isArray(config)) throw new Error("Invalid release configuration");
22
+ const event = JSON.parse(await readFile(process.env.GITHUB_EVENT_PATH, "utf8"));
23
+ const identity = parseFinalizationEvent(event, process.env.GITHUB_REPOSITORY ?? "", process.env.GITHUB_EVENT_NAME);
24
+ await finalizeReleasePleaseDraft({
25
+ env: process.env,
26
+ config,
27
+ ...identity
28
+ });
29
+ console.log("Qualified draft published as a prerelease");
30
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env bun
2
+ import { readJsonFile, runCli } from "./cli-runner.js";
3
+ import { gitCli, originRepository } from "../release/local-provenance.js";
4
+ import { runLocalPromotion } from "../release/local-release.js";
5
+ import { runPromotionCommand } from "../release/release-promotion-command.js";
6
+ // src/cli/release-promote-cli.ts
7
+ var local = process.argv[2] === "--local";
8
+ await runCli("Unable to promote the release; check the trusted workflow or feed and release configuration.", async () => {
9
+ const [path, out, ...extra] = process.argv.slice(local ? 3 : 2);
10
+ const held = process.env.STABLE_PROMOTION_HELD;
11
+ if (!path || extra.length || !out !== !local || ![
12
+ "true",
13
+ "false",
14
+ void 0
15
+ ].includes(held)) throw new Error("Invalid workflow invocation");
16
+ const config = await readJsonFile(path, 65536);
17
+ const result = local ? await runLocalPromotion({
18
+ config,
19
+ out,
20
+ now: (/* @__PURE__ */ new Date()).toISOString(),
21
+ held: held === "true",
22
+ repository: await originRepository(gitCli()),
23
+ fetch
24
+ }) : await runPromotionCommand({
25
+ env: process.env,
26
+ config
27
+ });
28
+ process.stdout.write(JSON.stringify(local ? {
29
+ ...result,
30
+ plan: void 0
31
+ } : result) + "\n");
32
+ }, { requireGitHubActions: !local });
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env bun
2
+ import { readJsonFile, runCli } from "./cli-runner.js";
3
+ import { gitCli } from "../release/local-provenance.js";
4
+ import { hostReleasePlatform, localTagProvenance, stageLocalRelease } from "../release/local-release.js";
5
+ import { runReleasePublishCommand } from "../release/release-publish-command.js";
6
+ // src/cli/release-publish-cli.ts
7
+ var local = process.argv[2] === "--local";
8
+ await runCli("Unable to publish release artifacts; check the trusted workflow or local checkout, receipts, signing configuration and staged bytes.", async () => {
9
+ const [directory, configPath, out, ...extra] = process.argv.slice(local ? 3 : 2);
10
+ if (!directory || !configPath || extra.length || !out !== !local) throw new Error("Invalid workflow invocation");
11
+ const config = await readJsonFile(configPath, 65536);
12
+ if (local) {
13
+ const { RELEASE_TAG: tag, SOURCE_SHA: sourceSha } = process.env;
14
+ if (!tag || !sourceSha) throw new Error("Missing local release identity");
15
+ const { repository } = await localTagProvenance({
16
+ config,
17
+ tag,
18
+ sourceSha,
19
+ git: gitCli()
20
+ });
21
+ const plan = await stageLocalRelease({
22
+ config,
23
+ directory,
24
+ out,
25
+ tag,
26
+ sourceSha,
27
+ repository,
28
+ platform: hostReleasePlatform(),
29
+ now: (/* @__PURE__ */ new Date()).toISOString(),
30
+ fetch
31
+ });
32
+ process.stdout.write(JSON.stringify({
33
+ tag,
34
+ objects: plan.objects.length
35
+ }) + "\n");
36
+ return;
37
+ }
38
+ const result = await runReleasePublishCommand({
39
+ env: process.env,
40
+ config,
41
+ directory
42
+ });
43
+ process.stdout.write(JSON.stringify({
44
+ tag: result.tag,
45
+ runId: result.runId,
46
+ runAttempt: result.runAttempt
47
+ }) + "\n");
48
+ }, { requireGitHubActions: !local });
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env bun
2
+ import { readJsonFile, runCli } from "./cli-runner.js";
3
+ import { signReleaseArtifact } from "../release/release-artifact.js";
4
+ import { createPrivateKey } from "node:crypto";
5
+ // src/cli/release-sign-cli.ts
6
+ await runCli("Unable to sign release artifact; check the identity, archive and signing key.", async () => {
7
+ const [identityPath, artifactPath, feed, ...extra] = process.argv.slice(2);
8
+ if (!identityPath || !artifactPath || !feed || extra.length || !process.env.ADEA_RELEASE_SIGNING_KEY) throw new Error("usage");
9
+ const identity = await readJsonFile(identityPath, 16384);
10
+ const key = createPrivateKey(process.env.ADEA_RELEASE_SIGNING_KEY);
11
+ const result = await signReleaseArtifact(artifactPath, identity, key, feed);
12
+ process.stdout.write(JSON.stringify(result) + "\n");
13
+ });
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};