feat: implement bitcoin-regtest-up runtime installer#9212
feat: implement bitcoin-regtest-up runtime installer#9212ulissesferreira wants to merge 2 commits into
Conversation
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.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 72cd7ec. Configure here.
| const yarnRc = readFileSync(yarnRcPath, 'utf8'); | ||
| if (/^\s*enableGlobalCache:\s*true\s*$/mu.test(yarnRc)) { | ||
| return join(homeDirectory, '.cache', 'metamask'); | ||
| } |
There was a problem hiding this comment.
Global cache YAML parsing mismatch
Medium Severity
getBitcoinRegtestCacheDirectory treats global cache as enabled only when a whole-line regex matches enableGlobalCache: true, while @metamask/foundryup parses .yarnrc.yml with YAML. Valid settings such as quoted booleans or inline comments can enable global cache for foundryup but keep this installer on a per-repo .metamask/cache path, splitting artifacts and breaking the documented parity.
Reviewed by Cursor Bugbot for commit 72cd7ec. Configure here.


Summary
This PR is the second of two PRs splitting #8827, stacked on top of:
@metamask/bitcoin-regtest-uppackage #9211 — scaffold:feat: scaffold @metamask/bitcoin-regtest-up packageIt 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 asbininpackage.json)src/index.ts— updated exportssrc/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— addsbinfield + version bump to 0.1.0CHANGELOG.md— changelog entry for the initial implementationREADME.md— full usage documentationjest.config.js— updated for the new test structure (relaxed coverage thresholds, CLI entry excluded)yarn.lock— updated for any new depsWhat's NOT included
No
knip.config.tschanges, 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
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 supply-chain or cache corruption, which tests and checksum checks mitigate.
Overview
Replaces the scaffold placeholder with a runtime-only installer for pinned Bitcoin Core 30.2 (darwin/linux, arm64/x64), modeled on
@metamask/foundryup: download tarball, verify SHA-256, extract to.metamask/cache(or~/.cache/metamaskwhen Yarn global cache is on), and dropbitcoind/bitcoin-cliwrappers undernode_modules/.bin. Test harnesses still own starting the node, regtest config, and seeding.install.tsdrives install/cache clean, optional overrides from rootpackage.json(bitcoinRegtestUpand aliases) and CLI flags, cache reuse with a runnable-daemon sanity check, and support for archives that shipbitcoind,bitcoin-node, or thebitcoinlauncher.bitcoin-regtest-upCLI exposes defaultinstall,cache clean, and--help.Docs/changelog describe usage;
package.jsonregisters the CLIbin; Jest adds broadinstall.test.tscoverage and relaxes thresholds while excluding the CLI entry from coverage.Reviewed by Cursor Bugbot for commit ec59f62. Bugbot is set up for automated code reviews on this repo. Configure here.