Files
cypress/packages/https-proxy/AGENTS.md
T
Ryan Manuel 4931cf06ff chore: bootstrap AI agent context files (AGENTS.md + CLAUDE.md) (#33429)
* chore: bootstrap AI agent context files (AGENTS.md + CLAUDE.md)

Adds a three-tier set of AI context files across the monorepo:

- Root AGENTS.md / CLAUDE.md — project overview, workspaces, common
  commands, architecture map, code conventions, and CI/CD summary
- Workspace-level pairs for cli/, packages/, npm/, tooling/,
  system-tests/, and scripts/
- Package-level pairs for all 33 packages/, 15 npm/, 3 tooling/
  packages, and the cli workspace (117 files total)

CLAUDE.md files are thin wrappers (@AGENTS.md import + workflow rules)
so Claude Code picks them up walking upward from cwd. AGENTS.md files
carry the substantive content and are also read natively by Codex CLI
and Cursor.

Command conventions applied throughout:
- No watch / file-watcher commands (agents run once and read results)
- No bare full-suite test runs for large packages; always target a
  specific file (<path-to-spec>) or glob ("<glob-pattern>")
- No cypress:open (interactive mode); use cypress:run with --spec
- Test runner syntax varies by package: vitest (test --),
  mocha (test-unit/test-integration --), jest (--testPathPattern),
  Cypress CT (cypress:run:ct -- --spec)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* gitignore

* clarify AI internal docs and contribution guidelines

* update TOC

* tweak nvm wording

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 16:01:52 -05:00

2.0 KiB

@packages/https-proxy

Acts as a dynamic TLS certificate authority so Cypress can intercept and inspect HTTPS traffic. It generates per-hostname certificates on the fly using node-forge, enabling the proxy to decrypt, modify, and re-encrypt bytes flowing between the browser and any HTTPS origin.

Key Commands

# Run a specific test file (single-file parallelism disabled — see Gotchas)
yarn workspace @packages/https-proxy test -- test/unit/ca.spec.ts

# Run tests matching a glob pattern
yarn workspace @packages/https-proxy test -- "test/unit/**/*.spec.ts"

# Build CJS and ESM outputs
yarn workspace @packages/https-proxy build

# Regenerate test CA certificates
yarn workspace @packages/https-proxy regenerate:certs

# Type-check
yarn workspace @packages/https-proxy check-ts

Architecture

lib/
  ca.ts       Certificate Authority: generates and caches per-hostname TLS certificates
  index.ts    Public entry point: creates and starts the proxy server
  proxy.ts    CONNECT-tunnel handler: intercepts TLS handshakes and injects CA cert
  server.ts   HTTP server wrapper used during testing
  util/
    parse.ts  Parses CONNECT request hostnames and ports

Gotchas / Notes

  • proxy.spec.ts and server.spec.ts cannot run in parallel because both bind to overlapping ports. The test-unit script uses vitest run without --pool=forks; the test-debug script explicitly passes --no-file-parallelism.
  • Test helper certificates live in test/helpers/certs/. Regenerate them with regenerate:certs (requires OpenSSL in $PATH) when they expire or when the CA key needs to rotate.
  • The semaphore package throttles concurrent certificate generation to avoid race conditions under high load.

Integration Points

  • Consumed by @packages/proxy and @packages/server which instantiate the HTTPS proxy server as part of the Cypress HTTP interception pipeline.
  • Depends on @packages/network (dev dep) for HTTP agent utilities used in integration tests.