Skip to content

Commit 7e3590a

Browse files
committed
docs(readme): conform to fleet skeleton (5 H2 sections, no wheelhouse leak)
1 parent dfd39d3 commit 7e3590a

1 file changed

Lines changed: 45 additions & 63 deletions

File tree

README.md

Lines changed: 45 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
# socket-bin
22

3-
Socket's `@socketbin/*` npm packages are **published from** this repo.
4-
The GitHub Actions workflow here is the one authorized to push new
5-
versions to npm. The binaries themselves (SEA-packed Node.js apps,
6-
build tooling, models) are _built_ in
3+
[![CI](https://github.com/SocketDev/socket-bin/actions/workflows/ci.yml/badge.svg)](https://github.com/SocketDev/socket-bin/actions/workflows/ci.yml)
4+
5+
Socket's `@socketbin/*` npm packages are **published from** this repo. The
6+
GitHub Actions workflow here is the one authorized to push new versions
7+
to npm. The binaries themselves (SEA-packed Node.js apps, build tooling,
8+
models) are _built_ in
79
[socket-btm](https://github.com/SocketDev/socket-btm); this repo only
810
takes finished binaries, verifies them, and publishes them.
911

1012
## Why this repo exists
1113

12-
The npm registry has a feature called **trusted publishing**: instead
13-
of storing a long-lived npm token in CI secrets, you tell npm "the
14-
GitHub Actions workflow at `<owner>/<repo>` is allowed to publish
15-
package X." When that workflow runs, it asks GitHub for a short-lived
16-
OIDC token, presents it to npm, and npm verifies it before accepting
17-
the publish.
14+
The npm registry has a feature called **trusted publishing**: instead of
15+
storing a long-lived npm token in CI secrets, you tell npm "the GitHub
16+
Actions workflow at `<owner>/<repo>` is allowed to publish package X."
17+
When that workflow runs, it asks GitHub for a short-lived OIDC token,
18+
presents it to npm, and npm verifies it before accepting the publish.
1819

1920
Because trust is bound to one repo, we split build from publish:
2021

@@ -25,72 +26,71 @@ Because trust is bound to one repo, we split build from publish:
2526
`@socketbin/*` scope.
2627

2728
Sister repo:
28-
[socket-addon](https://github.com/SocketDev/socket-addon) does the
29-
same for `@socketaddon/*` NAPI `.node` addons.
29+
[socket-addon](https://github.com/SocketDev/socket-addon) does the same
30+
for `@socketaddon/*` NAPI `.node` addons.
31+
32+
## Install
33+
34+
End users install the published packages, not this repo:
35+
36+
```sh
37+
npm install @socketbin/<tool>
38+
```
3039

31-
## Layout
40+
The umbrella package declares each per-platform package as
41+
`optionalDependencies` with `os` + `cpu` constraints, and npm installs
42+
only the matching one.
43+
44+
## Usage
45+
46+
Repository layout:
3247

3348
```
3449
packages/
3550
build-infra/ # shared helpers
3651
lib/release-checksums/
3752
core.mts # parse + hash + verify
3853
consumer.mts # download from sibling GH releases
39-
release-assets.json # which release tag we're on + per-asset SHA-256
40-
release-assets.schema.json # JSON Schema validating the .json above
54+
release-assets.json # release tag + per-asset SHA-256
55+
release-assets.schema.json # JSON Schema validating the .json
4156
<tool>/ # umbrella package on npm
4257
<tool>-<platform>-<arch>/ # per-platform shims
4358
scripts/
4459
publish.mts # the actual orchestrator
4560
```
4661

47-
For per-platform binaries, the umbrella + N per-platform packages
48-
pattern mirrors how Node-native modules ship: the umbrella declares
49-
each per-platform package as `optionalDependencies` with `os` + `cpu`
50-
constraints, and npm installs only the matching one. Consumers run
51-
`npm install @socketbin/<tool>` and get exactly the right binary.
52-
53-
For single-binary tools that don't fan out per-platform, a single
54-
top-level package may suffice.
55-
56-
`release-checksums/` is the **consumer half** of a fleet-wide helper
57-
trio (`core` + `consumer` + `producer`). The producer half lives in
58-
socket-btm — it generates `checksums.txt` at build time. We only need
59-
the consumer half here. The canonical copies are in
60-
[socket-wheelhouse](https://github.com/SocketDev/socket-wheelhouse/tree/main/template/packages/build-infra);
61-
sync-scaffolding flags drift.
62-
63-
## How a publish actually goes
62+
How a publish actually goes:
6463

6564
1. socket-btm finishes a build and cuts a GitHub Release like
6665
`<tool>-YYYYMMDD-<short-sha>`. The release contains the binary
67-
tarballs (one per platform-arch) plus a `checksums.txt` listing
68-
the SHA-256 of each.
69-
70-
2. Someone here updates `packages/build-infra/release-assets.json`
71-
with the new tag and the new per-asset SHA-256s. (The `$schema`
72-
pointer in that file makes editors autocomplete + flag typos.)
73-
66+
tarballs (one per platform-arch) plus a `checksums.txt` listing the
67+
SHA-256 of each.
68+
2. Someone here updates `packages/build-infra/release-assets.json` with
69+
the new tag and the new per-asset SHA-256s. The `$schema` pointer in
70+
that file makes editors autocomplete + flag typos.
7471
3. Someone triggers the GitHub Actions workflow at
7572
`.github/workflows/provenance.yml`. The workflow runs
7673
`scripts/publish.mts`, which:
7774
- Reads the embedded SHA-256s.
7875
- Downloads each artifact from socket-btm's GH Release.
7976
- Hashes the downloaded file and compares against the embedded
8077
SHA-256. Mismatch = abort the whole run, no packages published.
81-
- Stages the per-platform package in `os.tmpdir()` (so the working
82-
tree is never mutated), drops the verified binary into the
83-
stage, and runs `pnpm publish` from there.
78+
- Stages the per-platform package in `os.tmpdir()` so the working
79+
tree is never mutated, drops the verified binary into the stage,
80+
and runs `pnpm publish` from there.
8481
- Repeats for each platform, then publishes the umbrella package
8582
last (its `optionalDependencies` references the per-platforms by
8683
exact version, so they have to land on npm first).
8784

8885
If a checksum doesn't match, nothing publishes — fail-loudly.
8986

90-
## Local commands
87+
## Development
88+
89+
<details>
90+
<summary>Contributor commands</summary>
9191

9292
```sh
93-
pnpm install # install dependencies + run husky setup
93+
pnpm install # install dependencies + git hook setup
9494
pnpm run check # lint + type check
9595
pnpm run lint # lint files modified vs HEAD
9696
pnpm run lint --all # lint the whole workspace
@@ -106,25 +106,7 @@ pnpm run publish:ci # full publish — CI only, requires OIDC
106106
pnpm run clean # remove caches
107107
```
108108

109-
## Drift checks
110-
111-
Several files in this repo are required to be byte-identical to their
112-
counterparts in
113-
[socket-wheelhouse](https://github.com/SocketDev/socket-wheelhouse).
114-
That includes our git hooks, Claude Code hooks + skills, lint config,
115-
and the `release-checksums/` files mentioned above.
116-
117-
To check drift:
118-
119-
```sh
120-
node ../socket-wheelhouse/scripts/sync-scaffolding.mts --target . # socket-hook: allow cross-repo
121-
```
122-
123-
To auto-fix drift:
124-
125-
```sh
126-
node ../socket-wheelhouse/scripts/sync-scaffolding.mts --target . --fix # socket-hook: allow cross-repo
127-
```
109+
</details>
128110

129111
## License
130112

0 commit comments

Comments
 (0)