Skip to main content

Clone the Repository

Install Dependencies

envtrap uses pnpm workspace features:

Project Structure

The project is structured as a pnpm monorepo:

Building

To compile the TypeScript package source and copy raw ESM customization hooks to dist:

Running Tests

Integration tests verify interceptors under real process spawns, CommonJS imports, ESM loader injections, and network MITM proxied connections. First, ensure the package is built, then run tests in the test-server folder:

Running the Landing Page Locally

The site will be available at http://localhost:3000.

Running the Docs Locally

Install the Mintlify CLI:
Then start the dev server from the docs/ directory:
The docs will be available at http://localhost:3000.

Architecture Overview

If you want to contribute to the code:
  1. CLI Commands and Spawner: Handle flags and set up proxy/hooks environments in package/src/index.ts.
  2. ESM loader/CJS patches: Any changes to intercepted hooks for node:dns or node:child_process go in package/src/hooks.mjs.
  3. MITM HTTPS Decryption: The proxy handling and response blocking go in package/src/proxy.ts.
  4. Secret Scanning: The candidate filter and entropy logic go in package/src/fingerprint.ts.

Submitting a PR

  1. Fork the repository
  2. Create a branch: git checkout -b feat/my-feature
  3. Make your changes and add tests in test-server/test/integration.test.js
  4. Verify tests pass with pnpm test
  5. Submit a pull request with a clear description