Skip to content

Conversation

@YOU54F
Copy link
Member Author

YOU54F commented Oct 16, 2025

consideration needed for cli api wrappers in

  • pact-python-cli ( does it still have an api wrapper )
  • pact-js-cli

do we want to bring back client language wrappers at some point

pact-ruby has a publishing interface
pact-js-cli does
nestjs-pact does
pact-python v2 does
pact-php had one
pact-net had one

@YOU54F
Copy link
Member Author

YOU54F commented Oct 30, 2025

Had a go at some sample docs with an overview of the tools and various installation methods.

I think in a quick start, it might be good to show the central artefact, a pact file, and its differences between the specs (side by side tabs to switch between)

  1. download cli

showcase mock server

  1. start master mock server
  2. start mock server from pact (with option to write pact to any spec)
  3. validate mock server (fails - no request)
  4. make incorrect request with curl (fails)
  5. validate mock server (fails - incorrect request)
  6. make correct request with curl (passes)
  7. validate mock server (passes and outputs pact file)

user can now validate the output pact file against their the pacts in the getting started guide, either v1/v2/v3/v4

showcase pact verifier

  1. load pact file into verifier
  2. run verifier (fails, no host)
  3. create simple api host in users preferred language/framework which serves nothing but a root path (or spin up with php/python command line)
  4. run verifier (fails, cannot handle request/response from pact)
  5. implement simple endpoint to make pact contract pact

showcase stub server

  1. load pact file into stub server from disk
  2. make request with curl
  3. get stubbed response

showcase pact broker

  1. run pact broker locally with pact broker, either with docker or ruby
  2. use pact broker client to publish pacts
  3. use verifier to pull pacts from pact broker

showcase pact dsl's - consumer

  1. create dsl to recreate pact in example shown in docs and used in mock server
  2. run test (fails - no request)
  3. implement api client in users preferred language
  4. run test (passes)

showcase pact dsl's - provider

  1. create dsl to mirror verification options shown with verifier cli

Welcome to Pact CLI Tools

🔗 Contract testing made simple - Get started with Pact tools across all platforms and architectures.

Pact is a contract testing framework that enables consumer-driven contract testing, helping you build robust APIs and microservices. This document covers all available Pact tools and the multiple ways to install them on your system.

🛠️ Available Tools

Unified CLI (Recommended)

pact - All-in-one CLI with extension support

  • Combines all Pact tools in a single binary
  • Extensible architecture with plugin system
  • Mock/Stub Server, Provider Verifier, Broker Client & Plugin CLI
  • Built-in extension management

Individual Tools

pact-broker-client - Pact Broker interactions

  • Publish pacts to broker
  • Check deployment safety (can-i-deploy)
  • Record deployment events
  • Manage pacticipant versions and tags

pact-mock-server - Consumer testing

  • HTTP mock server built with Rust
  • Real-time request validation
  • Support for Pact V2, V3, V4 specifications
  • Plugin support for custom protocols

pact-verifier - Provider verification

  • Verify providers against consumer contracts
  • Provider states and state changes
  • Verify from files, URLs, or Pact Broker
  • Flexible interaction filtering

pact-plugin - Protocol extensions

  • Install and manage Pact plugins
  • Support for gRPC, GraphQL, Avro, custom protocols
  • Plugin discovery from repositories
  • Version management

pact-stub-server - Integration testing

  • Generate responses from Pact files
  • No request validation (unlike mock server)
  • CORS and TLS support
  • Load multiple Pact files simultaneously

pact-legacy - Ruby-based tools

  • Legacy compatibility tools
  • Ruby-based implementation
  • Message pact support

🚀 Installation Methods

Scripts (Cross-Platform - Linux/MacOS/Windows ARM64/AMD64)

*nix Users (including WSL/msys2/mingw)

# Unified CLI
curl -fsSL https://raw.githubusercontent.com/you54f/pact-cli/main/install.sh | sh
# Aliased: curl -fsSL https://lin.get-pact.saf.dev | sh

# Broker Client
curl -fsSL https://raw.githubusercontent.com/you54f/pact-broker-cli/main/install.sh | sh

PowerShell (Windows)

# Unified CLI
iwr -useb https://raw.githubusercontent.com/you54f/pact-cli/main/install.ps1 | iex
# Aliased: iwr -useb https://win.get-pact.saf.dev | iex

# Broker Client
iwr -useb https://raw.githubusercontent.com/you54f/pact-broker-cli/main/install.ps1 | iex

Cargo (Any Rust-supported target)

# Unified CLI
cargo install pact

# Individual tools
cargo install pact-plugin-cli
cargo install pact-stub-server
cargo install pact_mock_server_cli
cargo install pact_verifier_cli

Homebrew (MacOS/Linux ARM64/AMD64)

# Unified CLI
brew install you54f/brew/pact

# Individual tools
brew tap pact-foundation/brew
brew install pact-foundation/brew/pact-mock-server
brew install pact-foundation/brew/pact-stub-server
brew install pact-foundation/brew/pact-verifier
brew install pact-foundation/brew/pact-plugin
brew install pact-foundation/brew/pact-broker-client
brew install pact-foundation/brew/pact-legacy

Scoop (Windows ARM64/AMD64)

# Unified CLI
scoop bucket add pact https://github.com/you54f/scoop
scoop install pact

# Individual tools
scoop install pact-mock-server
scoop install pact-stub-server
scoop install pact-verifier
scoop install pact-plugin
scoop install pact-broker-client
scoop install pact-legacy

GitHub Actions Example

- name: Install Pact via Scoop
  if: runner.os == 'Windows'
  shell: powershell
  run: |
    scoop bucket add pact https://github.com/you54f/scoop
    scoop install pact
    scoop search pact
    pact --help

Chocolatey (Windows ARM64/AMD64)

# Unified CLI
curl https://github.com/YOU54F/choco/releases/download/choco/pact.0.9.0.nupkg -OutFile pact.nupkg
choco install -y pact --source .

# Windows on ARM - requires ForceARM64 parameter
choco install pact --params "'/ForceARM64:true'"

Individual Packages

choco install pact-broker-client
# Download: https://github.com/YOU54F/choco/releases/download/choco/pact-broker-client.0.4.1.nupkg

choco install pact-mock-server
# Download: https://github.com/YOU54F/choco/releases/download/choco/pact-mock-server.2.1.0.nupkg

choco install pact-verifier
# Download: https://github.com/YOU54F/choco/releases/download/choco/pact-verifier.1.3.0.nupkg

choco install pact-plugin
# Download: https://github.com/YOU54F/choco/releases/download/choco/pact-plugin.0.2.0.nupkg

choco install pact-stub-server
# Download: https://github.com/YOU54F/choco/releases/download/choco/pact-stub-server.0.7.0.nupkg

choco install pact-legacy
# Download: https://github.com/YOU54F/choco/releases/download/choco/pact-legacy.2.5.6.nupkg

Chocolatey GitHub Actions Example

- name: Install Pact via Chocolatey
  if: runner.os == 'Windows'
  shell: powershell
  run: |
    curl https://github.com/YOU54F/choco/releases/download/choco/pact.0.9.0.nupkg -OutFile pact.nupkg
    if ("${{ runner.arch }}" -eq "ARM64") {
      choco install -y pact --source . --params "'/ForceARM64:true'"
    } else {
      choco install -y pact --source .
    }
    pact --help

GitHub Actions

Direct action installation available:

# Unified CLI
- uses: you54f/pact-cli@main
- name: Show help
  run: |
    pact --help
    pact broker --help

# Broker Client
- uses: pact-foundation/pact-broker-cli@main
- name: Show help
  run: pact-broker-cli --help

Docker (ARM64/AMD64)

# Unified CLI
docker run --rm -it you54f/pact:latest

# Individual tools
docker run --rm -it you54f/pact-broker-cli:latest
docker run --rm -it you54f/pact-mock-server:latest
docker run --rm -it you54f/pact-stub-server:latest
docker run --rm -it you54f/pact-verifier:latest

🏗️ Platform Support

Platform x86_64 ARM64 Notes
Linux All installation methods
macOS All installation methods
Windows Some methods require ARM64 flags
Docker Multi-architecture images

🚦 Quick Start Guide

1. Choose Your Installation Method

  • Cross-platform: Use installation scripts
  • Rust developers: Use Cargo
  • macOS/Linux: Use Homebrew
  • Windows: Use Scoop or Chocolatey
  • CI/CD: Use GitHub Actions or Docker
  • Containers: Use Docker images

2. Start with the Unified CLI (Recommended)

# Install unified CLI (method varies by platform)
pact --version
pact --help

# List available extensions
pact extension list

# Install popular extensions
pact extension install pactflow-ai

3. Basic Usage Examples

# Mock server for consumer testing
pact mock --port 8080 --pact-dir ./pacts

# Verify provider
pact verify --pact-url ./consumer-provider.json --provider-base-url http://localhost:8080

# Publish to broker
pact broker publish ./pacts --broker-base-url https://broker.com

# Check deployment safety
pact broker can-i-deploy --pacticipant MyApp --version 1.0.0 --to production

📚 Documentation & Resources

🤝 Community & Support

  • GitHub Issues: Report issues in respective tool repositories
  • Slack: Join the Pact community
  • Stack Overflow: Tag questions with pact
  • Documentation: Comprehensive guides at docs.pact.io

🎯 Which Tool Should I Use?

For New Projects

Unified CLI (pact) - Single binary with all tools and extensions

For Existing Workflows

Individual tools - Drop-in replacements for existing Ruby tools

For CI/CD Pipelines

Docker images or GitHub Actions - Consistent, reproducible environments

For Development

Package managers (Homebrew, Scoop, Chocolatey) - Easy installation and updates


Ready to get started? Choose your preferred installation method above and dive into contract testing with Pact! 🚀

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