Skip to content

feat: implement bitcoin-regtest-up runtime installer#9212

Open
ulissesferreira wants to merge 4 commits into
mainfrom
add-bitcoin-regtest-up-package-impl
Open

feat: implement bitcoin-regtest-up runtime installer#9212
ulissesferreira wants to merge 4 commits into
mainfrom
add-bitcoin-regtest-up-package-impl

Conversation

@ulissesferreira

@ulissesferreira ulissesferreira commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR is the second of two PRs splitting #8827, stacked on top of:

It contains only the real implementation of the Bitcoin Core regtest runtime installer, with no unrelated monorepo changes.

What's included (delta vs scaffold PR)

  • src/install.ts — core Bitcoin Core download, SHA-256 checksum verification, extraction, and install logic (pinned to Bitcoin Core 30.2)
  • src/bin/bitcoin-regtest-up.ts — CLI entry point (registered as bin in package.json)
  • src/index.ts — updated exports
  • src/install.test.ts — Jest tests for the installer (11 tests covering download, verify, cache reuse, alternate binary layouts, cache clean)
  • src/index.test.ts — removed (replaced by install tests)
  • package.json — adds bin field + version bump to 0.1.0
  • CHANGELOG.md — changelog entry for the initial implementation
  • README.md — full usage documentation
  • jest.config.js — updated for the new test structure (relaxed coverage thresholds, CLI entry excluded)
  • yarn.lock — updated for any new deps

What's NOT included

No knip.config.ts changes, no CODEOWNERS/teams.json churn (those are in the scaffold PR), no unrelated monorepo changes.

Replaces

Together with #9211, this replaces #8827 with two clean, reviewable PRs based on current origin/main.

Verification

yarn workspace @metamask/bitcoin-regtest-up run build
yarn workspace @metamask/bitcoin-regtest-up run test
yarn eslint packages/bitcoin-regtest-up
yarn constraints
yarn workspace @metamask/bitcoin-regtest-up run changelog:validate
yarn dedupe --check

All passed ✓


Note

Low Risk
New dev/CI tooling package with checksum-verified downloads and no changes to production wallet or auth paths; main risk is incorrect binary wiring or cache behavior in local/CI environments.

Overview
Replaces the scaffold placeholder with a runtime-only Bitcoin Core installer for E2E/dev: consumers run bitcoin-regtest-up install (or default) to download a pinned 30.2 archive per platform, verify SHA-256, extract into .metamask/cache (or ~/.cache/metamask when Yarn enableGlobalCache is true in parsed .yarnrc.yml), and write node_modules/.bin/bitcoind and bitcoin-cli Node wrappers that forward args and propagate non-zero exits/signals.

The bitcoin-regtest-up CLI also supports cache clean (namespace-only), --help, and flags for cache/bin dirs, platform override, and URL/checksum overrides. package.json keys bitcoinRegtestUp / variants merge partial bitcoinCore overrides with defaults; missing package.json is tolerated for flag-only flows.

install.ts handles alternate archive layouts (bitcoind, bitcoin-node, bitcoin + node subcommand), cache reuse with runnable-binary checks, stale symlink replacement, and injectable download/extract for tests. Docs, changelog, yaml dependency, relaxed Jest coverage (CLI entry ignored), and broad install.test.ts coverage accompany the bin registration.

Reviewed by Cursor Bugbot for commit b76463a. Bugbot is set up for automated code reviews on this repo. Configure here.

@ulissesferreira ulissesferreira requested review from a team as code owners June 19, 2026 13:09
Comment thread packages/bitcoin-regtest-up/src/install.ts Outdated
@ulissesferreira ulissesferreira force-pushed the add-bitcoin-regtest-up-package-scaffold branch 2 times, most recently from fb0f940 to 87095cc Compare June 22, 2026 10:16
Base automatically changed from add-bitcoin-regtest-up-package-scaffold to main June 22, 2026 10:25
Replaces the scaffold placeholder with a foundryup-style installer that pins Bitcoin Core 30.2, downloads platform release archives, verifies SHA-256 checksums, and writes bitcoind/bitcoin-cli wrappers under node_modules/.bin.
@ulissesferreira ulissesferreira force-pushed the add-bitcoin-regtest-up-package-impl branch from ec59f62 to a50a074 Compare June 22, 2026 10:33

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a50a074. Configure here.

Comment thread packages/bitcoin-regtest-up/src/install.ts
- Parse .yarnrc.yml as YAML for global-cache detection
- Tolerate a missing package.json in the CLI option reader
- Merge partial bitcoinCore overrides with pinned defaults
- Propagate child termination signals as a non-zero wrapper exit
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.

2 participants