@alchemy.run/pkg 0.0.0-placeholder → 2.0.0-beta.79

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 (70) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +5 -0
  3. package/README.md +117 -0
  4. package/dist/Manifest.d.ts +107 -0
  5. package/dist/Manifest.d.ts.map +1 -0
  6. package/dist/Manifest.js +58 -0
  7. package/dist/Manifest.js.map +1 -0
  8. package/dist/Protocol.d.ts +186 -0
  9. package/dist/Protocol.d.ts.map +1 -0
  10. package/dist/Protocol.js +115 -0
  11. package/dist/Protocol.js.map +1 -0
  12. package/dist/Registry/Bindings.d.ts +134 -0
  13. package/dist/Registry/Bindings.d.ts.map +1 -0
  14. package/dist/Registry/Bindings.js +92 -0
  15. package/dist/Registry/Bindings.js.map +1 -0
  16. package/dist/Registry/GitHub.d.ts +96 -0
  17. package/dist/Registry/GitHub.d.ts.map +1 -0
  18. package/dist/Registry/GitHub.js +226 -0
  19. package/dist/Registry/GitHub.js.map +1 -0
  20. package/dist/Registry/Handler.d.ts +53 -0
  21. package/dist/Registry/Handler.d.ts.map +1 -0
  22. package/dist/Registry/Handler.js +375 -0
  23. package/dist/Registry/Handler.js.map +1 -0
  24. package/dist/Registry/KVCache.d.ts +24 -0
  25. package/dist/Registry/KVCache.d.ts.map +1 -0
  26. package/dist/Registry/KVCache.js +42 -0
  27. package/dist/Registry/KVCache.js.map +1 -0
  28. package/dist/Registry/Sweep.d.ts +12 -0
  29. package/dist/Registry/Sweep.d.ts.map +1 -0
  30. package/dist/Registry/Sweep.js +69 -0
  31. package/dist/Registry/Sweep.js.map +1 -0
  32. package/dist/Registry/Tags.d.ts +49 -0
  33. package/dist/Registry/Tags.d.ts.map +1 -0
  34. package/dist/Registry/Tags.js +80 -0
  35. package/dist/Registry/Tags.js.map +1 -0
  36. package/dist/Registry.d.ts +378 -0
  37. package/dist/Registry.d.ts.map +1 -0
  38. package/dist/Registry.js +119 -0
  39. package/dist/Registry.js.map +1 -0
  40. package/dist/cli/bin.d.ts +18 -0
  41. package/dist/cli/bin.d.ts.map +1 -0
  42. package/dist/cli/bin.js +33 -0
  43. package/dist/cli/bin.js.map +1 -0
  44. package/dist/cli/pack.d.ts +169 -0
  45. package/dist/cli/pack.d.ts.map +1 -0
  46. package/dist/cli/pack.js +447 -0
  47. package/dist/cli/pack.js.map +1 -0
  48. package/dist/cli/publish.d.ts +33 -0
  49. package/dist/cli/publish.d.ts.map +1 -0
  50. package/dist/cli/publish.js +76 -0
  51. package/dist/cli/publish.js.map +1 -0
  52. package/dist/index.d.ts +3 -0
  53. package/dist/index.d.ts.map +1 -0
  54. package/dist/index.js +6 -0
  55. package/dist/index.js.map +1 -0
  56. package/migrations/0001_init.sql +19 -0
  57. package/package.json +89 -1
  58. package/src/Manifest.ts +76 -0
  59. package/src/Protocol.ts +163 -0
  60. package/src/Registry/Bindings.ts +134 -0
  61. package/src/Registry/GitHub.ts +365 -0
  62. package/src/Registry/Handler.ts +549 -0
  63. package/src/Registry/KVCache.ts +68 -0
  64. package/src/Registry/Sweep.ts +117 -0
  65. package/src/Registry/Tags.ts +117 -0
  66. package/src/Registry.ts +197 -0
  67. package/src/cli/bin.ts +101 -0
  68. package/src/cli/pack.ts +603 -0
  69. package/src/cli/publish.ts +129 -0
  70. package/src/index.ts +5 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,5 @@
1
+ Alchemy
2
+ Copyright 2026 Functionless Corp.
3
+
4
+ This product includes software developed by third parties. See
5
+ THIRD_PARTY_LICENSES.md for attribution and license details.
package/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # @alchemy.run/pkg
2
+
3
+ Preview packages for pull requests. A Cloudflare Worker registry that verifies every publication against the GitHub Actions run that produced it, plus the `pkg` CLI that packs workspace packages and publishes them from CI.
4
+
5
+ Install URLs look like `https://pkg.alchemy.run/<name>/<tag>`, where `<tag>` is a commit SHA, a short SHA, `branch:<name>`, or `pr:<number>`:
6
+
7
+ ```sh
8
+ pnpm install https://pkg.alchemy.run/alchemy/pr:1516
9
+ pnpm install https://pkg.alchemy.run/alchemy/branch:main
10
+ pnpm install https://pkg.alchemy.run/alchemy/163c051
11
+ ```
12
+
13
+ ## How a publication flows
14
+
15
+ Every publication is a GitHub Actions **run**. The registry never trusts what a client says about commits, branches, or pull requests; it resolves the run through the GitHub API and derives every tag from that.
16
+
17
+ 1. One workflow runs on `push` and `pull_request`, builds the workspace, runs `pkg pack`, uploads the manifest as an artifact with `actions/upload-artifact`, and runs `pkg publish`. It needs no permissions and no secrets, so fork pull requests run it exactly like everything else.
18
+ 2. `pkg pack` prints the artifact name, `pkg-manifest-<sha256 of the manifest>`, as the `artifact-name` step output for the upload. Only the job's runtime token can add artifacts to the run, and the runner exposes that token to actions alone, which is why the upload is its own step. The artifact is GitHub's record that this run vouched for exactly these package hashes.
19
+ 3. Requests name the run they come from (repository, run id, attempt) and nothing else. The registry fetches the run through the App, requires it to be in progress, lists its artifacts, and refuses any manifest whose hash is not vouched for. Someone naming another run can only ever get that run's own manifest accepted, which changes nothing.
20
+ 4. One idempotent publish either answers with the tarballs it lacks, which the CLI uploads before publishing again, or points the tags, posts a "Preview packages" check run on the commit, and for pull requests updates the sticky comment. The manifest's `head` has to be the run's head commit, so a `pull_request` job must check out `github.event.pull_request.head.sha` rather than the merge commit.
21
+ 5. A run from a fork gets only the `pr:<number>` tag. Commit and branch tags are shared by every publisher, and a fork can run any commit, including one the repository already published, so it may not write them.
22
+
23
+ ## The `pkg` CLI
24
+
25
+ ```sh
26
+ pkg pack \
27
+ --group 'alchemy=./packages/alchemy' \
28
+ --group '@alchemy.run[Collapsed]=./packages/{better-auth,pkg}' \
29
+ --group '@distilled.cloud[Collapsed]=./submodules/distilled/packages/*' \
30
+ --registry https://pkg.alchemy.run \
31
+ --out .pkg
32
+
33
+ pkg publish --dir .pkg --registry https://pkg.alchemy.run
34
+ ```
35
+
36
+ | Flag | Command | Default |
37
+ | ------------ | --------------- | ------------------------------------------- |
38
+ | `--group` | `pack` | required, repeatable |
39
+ | `--registry` | `pack`, `publish` | `PKG_REGISTRY` env var, then `https://pkg.alchemy.run` |
40
+ | `--out` | `pack` | `.pkg` |
41
+ | `--dir` | `publish` | `.pkg` |
42
+
43
+ A group is `NAME=GLOB` or `NAME[Collapsed]=GLOB`. Globs support `*` as a whole path segment and `{a,b}` alternatives, so `./submodules/distilled/packages/{core,aws}` lists exactly those two. Repeat `--group` with the same name to add more directories to one group. `Collapsed` renders that group inside a closed `<details>` block in the install comment, for long lists of secondary packages.
44
+
45
+ For each non-private package under a group's glob, `pack`:
46
+
47
+ - packs in dependency order and rewrites every dependency on another packed package to that package's immutable tarball URL, `https://<registry>/<name>/-/<sha256>.tgz`, so a tarball's bytes depend only on its source and its dependencies' bytes and identical builds deduplicate across commits, pull requests, and repositories;
48
+ - repacks with fixed timestamps and no ownership so identical inputs hash identically, letting the registry skip uploads it already has;
49
+ - writes `pkg-manifest.json` describing the groups and each tarball's name, group, SHA-256, and size.
50
+
51
+ `publish` must run inside a GitHub Actions job, after the workflow has uploaded the manifest artifact. It refuses a directory packed for a different registry. `pack` alone is useful to inspect what would be published.
52
+
53
+ Under a `pull_request` event, check out `github.event.pull_request.head.sha` before packing. The default checkout is a synthetic merge commit that does not match the run's head, and `pack` fails early when it detects that.
54
+
55
+ ## Deploying the registry
56
+
57
+ The registry is one call in a Stack. It declares the Worker, the R2 bucket, the D1 index, and a KV cache under the id you give it, as `Pkg/Worker`, `Pkg/Bucket`, `Pkg/Database`, and `Pkg/Cache`:
58
+
59
+ ```ts
60
+ import { PkgRegistry } from "@alchemy.run/pkg/Registry";
61
+
62
+ const registry = yield* PkgRegistry("Pkg", {
63
+ worker: { domain: "pkg.alchemy.run" },
64
+ github: {
65
+ appId: Config.String("GH_APP_ID"),
66
+ privateKey: Config.Redacted("GH_APP_PRIVATE_KEY"),
67
+ },
68
+ policy: {
69
+ repos: ["alchemy-run/alchemy", "alchemy-run/distilled"],
70
+ ttl: Duration.weeks(1),
71
+ maxPackageSize: ByteSize.megabytes(100),
72
+ },
73
+ aliases: { "pkg.distilled.cloud": "@distilled.cloud" },
74
+ });
75
+ ```
76
+
77
+ | Option | Default | Meaning |
78
+ | ----------------------- | ------------------------ | ---------------------------------------------------------------------------------------- |
79
+ | `worker` | `{}` | Any Worker prop except `main`, `env`, and `crons`, which the registry owns |
80
+ | `github.appId` | required | The App id, read at deploy time and bound to the Worker |
81
+ | `github.privateKey` | required | The App's private key PEM, bound as a secret |
82
+ | `github.apiUrl` | `https://api.github.com` | GitHub API origin |
83
+ | `policy.repos` | required | Repositories allowed to publish, as `owner/name` |
84
+ | `policy.ttl` | one week | How long a publication lives |
85
+ | `policy.maxPackageSize` | unlimited | Upper bound on a single tarball |
86
+ | `aliases` | `{}` | Hostname to package scope, so `pkg.distilled.cloud/core/<sha>` serves `@distilled.cloud/core` |
87
+ | `cron` | `0 * * * *` | Schedule of the expiry sweep |
88
+
89
+ The package ships the Worker's bundle entry, so no separate entry file is needed. The options are encoded into a `PKG_SETTINGS` json binding at deploy time and decoded back inside the isolate, and the App credentials are bound as `PKG_GITHUB_APP_ID` and `PKG_GITHUB_APP_PRIVATE_KEY` and read lazily on the first GitHub call. The App needs `checks: write`, `pull_requests: write`, and `actions: read` on every repository in `policy.repos`.
90
+
91
+ The KV namespace caches what the Worker learns from GitHub, shared by every isolate: resolved runs for a minute, so the uploads that follow a publish do not repeat the lookup, and installation tokens until shortly before they expire, so one mint per repository serves about an hour. Everything in it is re-derivable, and a KV failure falls through to GitHub.
92
+
93
+ `alchemy dev` runs the Worker locally with the bucket, database, and cache emulated; the GitHub calls still go to the real API.
94
+
95
+ ## HTTP API
96
+
97
+ The contract lives in `@alchemy.run/pkg/Protocol` as an Effect `HttpApi`. The Worker implements it with `HttpApiBuilder`; the CLI calls it through `HttpApiClient`, so requests and typed errors are shared rather than duplicated.
98
+
99
+ | Route | Purpose |
100
+ | ----------------------------------------- | ---------------------------------------------------------------------------------------- |
101
+ | `POST /api/publish` | Body `{ run, manifest }`. Answers `409 MissingTarballs` with what to upload, or the tags |
102
+ | `PUT /api/tarballs/:name/:sha256?repo&runId&attempt` | Content-addressed upload, streamed into R2 with the hash verified by R2 |
103
+ | `GET /api/health` | `{ ok: true }` |
104
+ | `GET /<name>/<tag>` | 302 to the tarball the tag points at |
105
+ | `GET /<name>/-/<sha256>.tgz` | The immutable tarball |
106
+
107
+ `run` is `{ repo, runId, attempt }`. Errors are `BadRequest` (400), `Forbidden` (403), `RunNotInProgress` (409), `MissingTarballs` (409), `PackageTooLarge` (413), and `Upstream` (502) for GitHub failures.
108
+
109
+ ## Policy
110
+
111
+ `repos` lists the repositories allowed to publish. A publication may contain any package; every package gets the commit, short commit, `branch:<name>`, and `pr:<number>` tags of the run that produced it, and nothing in the manifest can name a different commit. A package built from a submodule is therefore tagged with the publishing repository's commit; dependency links between tarballs use content URLs and do not involve commits at all.
112
+
113
+ ## Cleanup
114
+
115
+ The registry keeps one table: `tags(package, tag, sha256, expires_at, linked_prs)`. A tarball lives in R2 for as long as any row points at it.
116
+
117
+ Every publication of a tag refreshes `expires_at` to now plus `ttl`. Rows produced by pull request runs also record the pull request in `linked_prs`; a commit tag shared by several pull requests records all of them. The sweep re-checks rows that are about to expire: while any linked pull request is open the row is extended by `ttl`, and once they are all closed or merged the expiry is pinned to the latest close time plus `ttl`. Branch publications simply expire `ttl` after the push. The sweep then deletes expired rows, tarballs no row points at, and uploads older than a day that never got tagged.
@@ -0,0 +1,107 @@
1
+ import * as Schema from "effect/Schema";
2
+ /**
3
+ * An npm package name, scoped or unscoped, under the rules npm applies to
4
+ * new packages: lowercase, URL-safe, at most 214 characters. Names end up
5
+ * in R2 keys, install URLs, and the markdown of comments and check runs,
6
+ * so nothing outside this set is ever accepted from a client.
7
+ */
8
+ export declare const PackageName: Schema.String;
9
+ /** A display group label for the install comment: `Alchemy`, `@alchemy.run`. */
10
+ export declare const GroupName: Schema.String;
11
+ /**
12
+ * One packed workspace package inside a `pkg pack` artifact.
13
+ *
14
+ * Everything here is data the CLI observed while packing. The registry never
15
+ * derives a tag from it: every tag comes from the GitHub Actions run that
16
+ * vouched for the manifest, and R2 verifies uploaded tarball bytes against
17
+ * the hash they are stored under.
18
+ */
19
+ export declare const ManifestPackage: Schema.Struct<{
20
+ readonly name: Schema.String;
21
+ /** Version from the package manifest at pack time. */
22
+ readonly version: Schema.String;
23
+ /** Package directory relative to the workspace root, POSIX separators. */
24
+ readonly dir: Schema.String;
25
+ readonly group: Schema.String;
26
+ /** Tarball file name inside the artifact directory. */
27
+ readonly file: Schema.String;
28
+ /** Lowercase hex SHA-256 of the tarball bytes. */
29
+ readonly sha256: Schema.String;
30
+ /** Tarball size in bytes. */
31
+ readonly size: Schema.Number;
32
+ }>;
33
+ export type ManifestPackage = typeof ManifestPackage.Type;
34
+ /** A display group in the install comment, in the order `pkg pack` listed it. */
35
+ export declare const ManifestGroup: Schema.Struct<{
36
+ readonly name: Schema.String;
37
+ /** Render the group collapsed in the install comment. */
38
+ readonly collapsed: Schema.Boolean;
39
+ }>;
40
+ export type ManifestGroup = typeof ManifestGroup.Type;
41
+ /**
42
+ * The `pkg-manifest.json` written next to the tarballs by `pkg pack` and read
43
+ * back by `pkg publish`.
44
+ */
45
+ export declare const Manifest: Schema.Struct<{
46
+ readonly version: Schema.Literal<1>;
47
+ readonly groups: Schema.$Array<Schema.Struct<{
48
+ readonly name: Schema.String;
49
+ /** Render the group collapsed in the install comment. */
50
+ readonly collapsed: Schema.Boolean;
51
+ }>>;
52
+ /** Registry origin the tarball dependencies were rewritten against. */
53
+ readonly registry: Schema.String;
54
+ /**
55
+ * HEAD commit of the root repository at pack time. The registry requires
56
+ * it to be the head of the run that publishes, since that is the commit
57
+ * every tag names.
58
+ */
59
+ readonly head: Schema.String;
60
+ readonly packages: Schema.$Array<Schema.Struct<{
61
+ readonly name: Schema.String;
62
+ /** Version from the package manifest at pack time. */
63
+ readonly version: Schema.String;
64
+ /** Package directory relative to the workspace root, POSIX separators. */
65
+ readonly dir: Schema.String;
66
+ readonly group: Schema.String;
67
+ /** Tarball file name inside the artifact directory. */
68
+ readonly file: Schema.String;
69
+ /** Lowercase hex SHA-256 of the tarball bytes. */
70
+ readonly sha256: Schema.String;
71
+ /** Tarball size in bytes. */
72
+ readonly size: Schema.Number;
73
+ }>>;
74
+ }>;
75
+ export type Manifest = typeof Manifest.Type;
76
+ export declare const ManifestJson: Schema.fromJsonString<Schema.Struct<{
77
+ readonly version: Schema.Literal<1>;
78
+ readonly groups: Schema.$Array<Schema.Struct<{
79
+ readonly name: Schema.String;
80
+ /** Render the group collapsed in the install comment. */
81
+ readonly collapsed: Schema.Boolean;
82
+ }>>;
83
+ /** Registry origin the tarball dependencies were rewritten against. */
84
+ readonly registry: Schema.String;
85
+ /**
86
+ * HEAD commit of the root repository at pack time. The registry requires
87
+ * it to be the head of the run that publishes, since that is the commit
88
+ * every tag names.
89
+ */
90
+ readonly head: Schema.String;
91
+ readonly packages: Schema.$Array<Schema.Struct<{
92
+ readonly name: Schema.String;
93
+ /** Version from the package manifest at pack time. */
94
+ readonly version: Schema.String;
95
+ /** Package directory relative to the workspace root, POSIX separators. */
96
+ readonly dir: Schema.String;
97
+ readonly group: Schema.String;
98
+ /** Tarball file name inside the artifact directory. */
99
+ readonly file: Schema.String;
100
+ /** Lowercase hex SHA-256 of the tarball bytes. */
101
+ readonly sha256: Schema.String;
102
+ /** Tarball size in bytes. */
103
+ readonly size: Schema.Number;
104
+ }>>;
105
+ }>>;
106
+ export declare const MANIFEST_FILE = "pkg-manifest.json";
107
+ //# sourceMappingURL=Manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Manifest.d.ts","sourceRoot":"","sources":["../src/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,WAAW,eAOvB,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,SAAS,eAErB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;;IAE1B,sDAAsD;;IAEtD,0EAA0E;;;IAG1E,uDAAuD;;IAEvD,kDAAkD;;IAElD,6BAA6B;;EAE7B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC;AAE1D,iFAAiF;AACjF,eAAO,MAAM,aAAa;;IAExB,yDAAyD;;EAEzD,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;QATnB,yDAAyD;;;IAYzD,uEAAuE;;IAEvE;;;;OAIG;;;;QAnCH,sDAAsD;;QAEtD,0EAA0E;;;QAG1E,uDAAuD;;QAEvD,kDAAkD;;QAElD,6BAA6B;;;EA6B7B,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;AAE5C,eAAO,MAAM,YAAY;;;;QAxBvB,yDAAyD;;;IAYzD,uEAAuE;;IAEvE;;;;OAIG;;;;QAnCH,sDAAsD;;QAEtD,0EAA0E;;;QAG1E,uDAAuD;;QAEvD,kDAAkD;;QAElD,6BAA6B;;;GAgC4B,CAAC;AAE5D,eAAO,MAAM,aAAa,sBAAsB,CAAC"}
@@ -0,0 +1,58 @@
1
+ import * as Schema from "effect/Schema";
2
+ /**
3
+ * An npm package name, scoped or unscoped, under the rules npm applies to
4
+ * new packages: lowercase, URL-safe, at most 214 characters. Names end up
5
+ * in R2 keys, install URLs, and the markdown of comments and check runs,
6
+ * so nothing outside this set is ever accepted from a client.
7
+ */
8
+ export const PackageName = Schema.String.pipe(Schema.check(Schema.isPattern(/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/), Schema.isMaxLength(214)));
9
+ /** A display group label for the install comment: `Alchemy`, `@alchemy.run`. */
10
+ export const GroupName = Schema.String.pipe(Schema.check(Schema.isPattern(/^[@A-Za-z0-9][A-Za-z0-9 ._@/-]{0,63}$/)));
11
+ /**
12
+ * One packed workspace package inside a `pkg pack` artifact.
13
+ *
14
+ * Everything here is data the CLI observed while packing. The registry never
15
+ * derives a tag from it: every tag comes from the GitHub Actions run that
16
+ * vouched for the manifest, and R2 verifies uploaded tarball bytes against
17
+ * the hash they are stored under.
18
+ */
19
+ export const ManifestPackage = Schema.Struct({
20
+ name: PackageName,
21
+ /** Version from the package manifest at pack time. */
22
+ version: Schema.String,
23
+ /** Package directory relative to the workspace root, POSIX separators. */
24
+ dir: Schema.String,
25
+ group: GroupName,
26
+ /** Tarball file name inside the artifact directory. */
27
+ file: Schema.String,
28
+ /** Lowercase hex SHA-256 of the tarball bytes. */
29
+ sha256: Schema.String,
30
+ /** Tarball size in bytes. */
31
+ size: Schema.Number,
32
+ });
33
+ /** A display group in the install comment, in the order `pkg pack` listed it. */
34
+ export const ManifestGroup = Schema.Struct({
35
+ name: GroupName,
36
+ /** Render the group collapsed in the install comment. */
37
+ collapsed: Schema.Boolean,
38
+ });
39
+ /**
40
+ * The `pkg-manifest.json` written next to the tarballs by `pkg pack` and read
41
+ * back by `pkg publish`.
42
+ */
43
+ export const Manifest = Schema.Struct({
44
+ version: Schema.Literal(1),
45
+ groups: Schema.Array(ManifestGroup),
46
+ /** Registry origin the tarball dependencies were rewritten against. */
47
+ registry: Schema.String,
48
+ /**
49
+ * HEAD commit of the root repository at pack time. The registry requires
50
+ * it to be the head of the run that publishes, since that is the commit
51
+ * every tag names.
52
+ */
53
+ head: Schema.String,
54
+ packages: Schema.Array(ManifestPackage),
55
+ });
56
+ export const ManifestJson = Schema.fromJsonString(Manifest);
57
+ export const MANIFEST_FILE = "pkg-manifest.json";
58
+ //# sourceMappingURL=Manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Manifest.js","sourceRoot":"","sources":["../src/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAC3C,MAAM,CAAC,KAAK,CACV,MAAM,CAAC,SAAS,CACd,4DAA4D,CAC7D,EACD,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CACxB,CACF,CAAC;AAEF,gFAAgF;AAChF,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CACzC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,uCAAuC,CAAC,CAAC,CACxE,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,WAAW;IACjB,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,0EAA0E;IAC1E,GAAG,EAAE,MAAM,CAAC,MAAM;IAClB,KAAK,EAAE,SAAS;IAChB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC,MAAM;CACpB,CAAC,CAAC;AAGH,iFAAiF;AACjF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,SAAS;IACf,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC,OAAO;CAC1B,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;IACnC,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAC,MAAM;IACvB;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC;CACxC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;AAE5D,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC"}