Skip to content

feat(stacks): add the GitHub-repos Alchemy stack - #445

Open
Mkassabov wants to merge 7 commits into
mainfrom
claude/alchemy-github-repos-stack-dab787
Open

feat(stacks): add the GitHub-repos Alchemy stack#445
Mkassabov wants to merge 7 commits into
mainfrom
claude/alchemy-github-repos-stack-dab787

Conversation

@Mkassabov

Copy link
Copy Markdown
Collaborator

What

Adds stacks/github — an Alchemy stack that manages one alchemy-run/distilled-<name> GitHub repository per packages/* directory (23 today: 22 SDKs + core), plus a deploy-github-stack workflow that deploys it on every push to main (usually a no-op) and on workflow_dispatch.

Long term these repos will hold per-SDK snapshots so consumers can fetch just the SDK they need at --depth=1 instead of cloning the monorepo or its multi-GB spec submodules. This PR only creates/converges the repositories; pushing snapshot content is a follow-up.

How

  • alchemy.run.ts discovers the package list from packages/* at deploy time, so a new SDK package automatically gets its repo on the next deploy.
  • GitHub.Repository converges against the live repo: existing repos are adopted and their settings synced, never duplicated; the default removal policy is retain, so nothing here can delete a repository.
  • State is local (.alchemy/state, gitignored). Empty state per CI run is safe for this stack because every resource reconciles against the live GitHub API.
  • stacks/github is deliberately not a workspace member and carries its own bun.lock: alchemy@2.0.0-beta.70 is built against effect@4.0.0-beta.103 (Schema.TaggedErrorClass, removed in beta.104), while the monorepo catalog hoists beta.105 — a shared install breaks at import time.

Setup required before merge

The workflow needs an ALCHEMY_GITHUB_TOKEN repository secret: a PAT with repo scope and permission to create repositories in the alchemy-run org (the built-in GITHUB_TOKEN cannot create repositories).

Verified

  • tsc -p stacks/github/tsconfig.json passes (real checking, noCheck off).
  • CI=1 GITHUB_ACCESS_TOKEN=… bun alchemy plan --stage prod builds the stack and plans 23 creates, one per package.
  • Confirmed alchemy's CI auth path: with CI=true (set by Actions) it auto-selects the env method and reads GITHUB_ACCESS_TOKEN.

Adds stacks/github, an Alchemy stack that manages one
alchemy-run/distilled-<name> repository per packages/* SDK (23 today:
22 SDKs + core), discovered from the filesystem at deploy time. A new
deploy-github-stack workflow deploys it on every push to main (usually
a no-op) using the ALCHEMY_GITHUB_TOKEN PAT secret.

The stack is standalone (own bun.lock, not a workspace member) because
alchemy@2.0.0-beta.70 requires effect 4.0.0-beta.103 while the monorepo
catalog hoists beta.105.
Swap localState() for Cloudflare.state() — the same remote state store
the alchemy monorepo uses — so local and CI deploys converge one shared
stack. The workflow now also passes CLOUDFLARE_API_TOKEN /
CLOUDFLARE_ACCOUNT_ID and deploys with --yes so state-store upgrade
prompts can't hang CI. The target org is now the DISTILLED_REPOS_OWNER
repository variable (falling back to alchemy-run) ahead of the move to
a dedicated snapshot org.
Latest main release. Kills the effect version skew: beta.70 was built
against the pre-rename Schema API (effect beta.103) while its
@distilled.cloud deps floated to beta.105.
A stale bun manifest cache resolved next to the broken beta.70
(built against pre-rename effect Schema API); force-refreshed so the
lockfile pins beta.72 + effect beta.105.
Follows the alchemy CI/CD tutorial: deployed once with an admin
profile, it mints a Cloudflare API token scoped to the state-store
worker and seeds all four CI values (CLOUDFLARE_API_TOKEN,
CLOUDFLARE_ACCOUNT_ID, ALCHEMY_GITHUB_TOKEN, DISTILLED_REPOS_OWNER)
into this repo's Actions configuration as code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant