Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
1 change: 1 addition & 0 deletions .vite-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vp staged
39 changes: 39 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# AGENTS.md

`@samebase/alchemy-cloudflare-workers-builds` is a community Alchemy v2 provider for Cloudflare
Workers that Workers Builds deploys. It is pinned to `alchemy@2.0.0-beta.80` and Effect 4.

## Ownership rule

- Wrangler owns the version. This package owns the Worker shell, the Workers Builds link, the
build variables, and the Worker secrets.
- Never write the Worker's version, bindings, vars, assets, routes, or code. The Wrangler file in
the user's repository is the only source of truth for them.

## Commands

- Vite+ (`vp`) owns format, lint, test, and build.
- `pnpm run check`: format check, lint, typecheck, and unit tests. Run it before each commit.
- `pnpm run build`: write `lib/` with `vp pack`. publint and attw then check the package.
- The pre-commit hook runs `vp staged`. The `prepare` script installs the hook.

## Tests

- Unit tests read recorded real Cloudflare and GitHub payloads in `test/fixtures/`.
- Make a negative case from a changed recorded payload. Do not write a fixture from scratch.
- Replace a fixture from the API schema with a recording when a live run records it.
- Do not commit a token, a secret value, or other credentials.
- Live tests make real API calls. They run only with `ALCHEMY_WORKERS_BUILDS_LIVE=1` (`test:live`).

## Automation and docs

- Write automation in TypeScript under `scripts/`. Node 24 from `.node-version` runs it.
- Automation must work on macOS, Linux, and Windows without Bash or PowerShell.
- Do not add authored `.js`, `.mjs`, or `.cjs` files.
- Write docs in ASD-STE100 Simplified Technical English. Do not use the em dash character.

## Releases

- To release, change `version` in `package.json` and add a `CHANGELOG.md` entry in a pull request.
- After the merge, `.github/workflows/release.yml` publishes that version from `main` to npm.
- Do not change `version` in other pull requests.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,18 @@ Outputs: `workerName`, `name`, `accountId`.
```sh
pnpm install
pnpm run check # format, lint, typecheck, unit tests
pnpm run build # lib/ with declarations
pnpm run build # lib/ with declarations, then publint and attw
pnpm run test:live # real API calls, see below
```

Use Node 24 (`.node-version`) and pnpm 11. `pnpm install` also installs a pre-commit hook that
runs `vp staged`.

Unit tests run against recorded Cloudflare and GitHub payloads in `test/fixtures/`, and against
secret and build token payloads that follow Cloudflare's API schema until a live run records them.
They make no network calls.

Live tests run only with `ALCHEMY_WORKERS_BUILDS_LIVE=1`:
Live tests run only with `ALCHEMY_WORKERS_BUILDS_LIVE=1`, which `pnpm run test:live` sets:

- `permission.live.test.ts` needs only the network. It runs a plan through the Alchemy engine with
a placeholder token and expects `WorkersBuildsPermissionError`.
Expand All @@ -312,7 +315,8 @@ Live tests run only with `ALCHEMY_WORKERS_BUILDS_LIVE=1`:
repository. It creates a Worker shell named `tmp-alchemy-workers-builds-secret-*`, writes,
updates, and deletes a secret on it, and deletes the Worker.

Releases: push a `v*` tag; `.github/workflows/release.yml` publishes with npm trusted publishing.
Releases: change `version` in `package.json` in a pull request. After the merge,
`.github/workflows/release.yml` publishes that version from `main` with npm trusted publishing.

## License

Expand Down
13 changes: 13 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Security

Do not report security vulnerabilities in a public issue.

Use
[GitHub private vulnerability reporting](../../security/advisories/new)
to report a vulnerability. Include the affected workflow, the expected result, the actual result,
and the minimum steps needed to reproduce it.

The repository owner must enable private vulnerability reporting before the repository becomes
public.

Use [GitHub Issues](../../issues) for non-sensitive bugs and support requests.
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,24 @@
"check": "vp fmt --check && vp lint && pnpm run typecheck && vp test --run",
"typecheck": "tsc --noEmit",
"test": "vp test --run",
"test:live": "ALCHEMY_WORKERS_BUILDS_LIVE=1 vp test --run test/live",
"test:live": "node ./scripts/test-live.ts",
"format": "vp fmt",
"lint": "vp lint",
"build": "rm -rf lib && tsc -p tsconfig.build.json",
"prepack": "pnpm run build"
"build": "vp pack",
"prepack": "pnpm run build",
"prepare": "vp config --no-agent"
},
"dependencies": {
"@distilled.cloud/cloudflare": "1.0.0-rc.13"
},
"devDependencies": {
"@arethetypeswrong/core": "^0.18.5",
"@effect/platform-node": "4.0.0",
"@effect/vitest": "4.0.0",
"@types/node": "^24.0.0",
"alchemy": "2.0.0-beta.80",
"effect": "4.0.0",
"publint": "^0.3.25",
"typescript": "^5.9.0",
"vite-plus": "0.3.0",
"vitest": "^4.0.0"
Expand Down
Loading
Loading