|
| 1 | +# Pact CLI Extensions |
| 2 | + |
| 3 | +The Pact CLI supports an extension system that allows you to install and manage additional tools and legacy binaries. Extensions integrate with the main CLI, providing access to functionality like AI-powered contract testing and legacy Pact Ruby based tools. |
| 4 | + |
| 5 | +## 🚀 Quick Start |
| 6 | + |
| 7 | +```bash |
| 8 | +# List available extensions |
| 9 | +pact extension list |
| 10 | + |
| 11 | +# Install PactFlow AI extension |
| 12 | +pact extension install pactflow-ai |
| 13 | + |
| 14 | +# Install Ruby legacy tools |
| 15 | +pact extension install pact-ruby-standalone |
| 16 | + |
| 17 | +# Use PactFlow AI directly |
| 18 | +pact pactflow ai --help |
| 19 | + |
| 20 | +# Use legacy tools |
| 21 | +pact extension pact-broker-legacy --help |
| 22 | +``` |
| 23 | + |
| 24 | +## 📦 Available Extensions |
| 25 | + |
| 26 | +### PactFlow AI |
| 27 | + |
| 28 | +**AI-augmented contract testing tools** |
| 29 | + |
| 30 | +- **Name**: `pactflow-ai` |
| 31 | +- **Type**: PactFlow AI |
| 32 | +- **Usage**: `pact pactflow ai <args>` or `pact extension pactflow-ai <args>` |
| 33 | +- **Features**: AI-augmented contract generation, reviews |
| 34 | +- **Platforms**: macOS (Intel/Apple Silicon), Linux (x64/ARM64), Windows (x64/ARM64) |
| 35 | + |
| 36 | +### Ruby Legacy Tools |
| 37 | + |
| 38 | +**Traditional Ruby-based Pact tools (pact-ruby-standalone)** |
| 39 | + |
| 40 | +- **Name**: `pact-ruby-standalone` |
| 41 | +- **Type**: Ruby Legacy |
| 42 | +- **Includes**: |
| 43 | + - `pact-broker-legacy` - Legacy Pact Broker client |
| 44 | + - `pactflow-legacy` - Legacy PactFlow client |
| 45 | + - `message-legacy` - Legacy message pact tools |
| 46 | + - `mock-legacy` - Legacy mock service |
| 47 | + - `verifier-legacy` - Legacy provider verifier |
| 48 | + - `stub-legacy` - Legacy stub service |
| 49 | +- **Usage**: `pact extension <tool-name> <args>` |
| 50 | +- **Platforms**: macOS, Linux, Windows |
| 51 | + |
| 52 | +## 🛠 Extension Management |
| 53 | + |
| 54 | +### Installation |
| 55 | + |
| 56 | +```bash |
| 57 | +# Install latest version |
| 58 | +pact extension install pactflow-ai |
| 59 | +pact extension install pact-ruby-standalone |
| 60 | + |
| 61 | +# Install specific version |
| 62 | +pact extension install pactflow-ai --version 1.11.4 |
| 63 | +pact extension install pact-ruby-standalone --version v2.5.5 |
| 64 | +``` |
| 65 | + |
| 66 | +### Listing Extensions |
| 67 | + |
| 68 | +```bash |
| 69 | +# List all extensions |
| 70 | +pact extension list |
| 71 | + |
| 72 | +# Show only installed extensions |
| 73 | +pact extension list --installed |
| 74 | +``` |
| 75 | + |
| 76 | +Output example: |
| 77 | + |
| 78 | +``` |
| 79 | +📦 Available extensions: |
| 80 | +Name Type Installed Latest Status |
| 81 | +--------------------------------------------------------------------------- |
| 82 | +pactflow-ai PactFlow AI 1.11.4 1.11.4 ✅ Installed |
| 83 | +pact-broker-legacy Ruby Legacy v2.5.5 v2.5.5 ✅ Installed |
| 84 | +pactflow-legacy Ruby Legacy v2.5.5 v2.5.5 ✅ Installed |
| 85 | +message-legacy Ruby Legacy v2.5.5 v2.5.5 ✅ Installed |
| 86 | +mock-legacy Ruby Legacy v2.5.5 v2.5.5 ✅ Installed |
| 87 | +verifier-legacy Ruby Legacy v2.5.5 v2.5.5 ✅ Installed |
| 88 | +stub-legacy Ruby Legacy v2.5.5 v2.5.5 ✅ Installed |
| 89 | +``` |
| 90 | + |
| 91 | +### Updating Extensions |
| 92 | + |
| 93 | +```bash |
| 94 | +# Update all installed extensions |
| 95 | +pact extension update --all |
| 96 | + |
| 97 | +# Update specific extension |
| 98 | +pact extension update pactflow-ai |
| 99 | +pact extension update pact-ruby-standalone |
| 100 | +``` |
| 101 | + |
| 102 | +### Uninstalling Extensions |
| 103 | + |
| 104 | +```bash |
| 105 | +# Uninstall PactFlow AI |
| 106 | +pact extension uninstall pactflow-ai |
| 107 | + |
| 108 | +# Uninstall Ruby legacy tools (removes all legacy tools) |
| 109 | +pact extension uninstall pact-ruby-standalone |
| 110 | + |
| 111 | +# Uninstall individual legacy tool |
| 112 | +pact extension uninstall pact-broker-legacy |
| 113 | +``` |
| 114 | + |
| 115 | +## 🔧 Usage Patterns |
| 116 | + |
| 117 | +### PactFlow AI Integration |
| 118 | + |
| 119 | +The PactFlow AI extension integrates seamlessly with the `pactflow` command: |
| 120 | + |
| 121 | +```bash |
| 122 | +# These are equivalent: |
| 123 | +pact pactflow ai --help |
| 124 | +pact extension pactflow-ai --help |
| 125 | +``` |
| 126 | + |
| 127 | +### Legacy Ruby Tools |
| 128 | + |
| 129 | +Legacy tools are accessed via the extension system: |
| 130 | + |
| 131 | +```bash |
| 132 | +# Legacy Pact Broker operations |
| 133 | +pact extension pact-broker-legacy can-i-deploy --pacticipant my-app --version 1.0.0 |
| 134 | + |
| 135 | +# Legacy provider verification |
| 136 | +pact extension verifier-legacy |
| 137 | + |
| 138 | +# Legacy mock service |
| 139 | +pact extension mock-legacy |
| 140 | +``` |
| 141 | + |
| 142 | +## 📁 Extension Storage |
| 143 | + |
| 144 | +Extensions are installed to `~/.pact/extensions/` by default: |
| 145 | + |
| 146 | +``` |
| 147 | +~/.pact/extensions/ |
| 148 | +├── config.json # Extension configuration |
| 149 | +├── bin/ # Symlinks to extension binaries |
| 150 | +│ ├── pactflow-ai |
| 151 | +│ ├── pact-broker-legacy |
| 152 | +│ ├── pactflow-legacy |
| 153 | +│ ├── message-legacy |
| 154 | +│ ├── mock-legacy |
| 155 | +│ ├── verifier-legacy |
| 156 | +│ └── stub-legacy |
| 157 | +└── pact-ruby-standalone/ # Ruby tools installation |
| 158 | + └── bin/ |
| 159 | + ├── pact-broker |
| 160 | + ├── pactflow |
| 161 | + ├── pact-message |
| 162 | + ├── pact-mock-service |
| 163 | + ├── pact-provider-verifier |
| 164 | + └── pact-stub-service |
| 165 | +``` |
| 166 | + |
| 167 | +### Custom Installation Directory |
| 168 | + |
| 169 | +You can customize the extension directory using the `PACT_CLI_EXTENSIONS_HOME` environment variable: |
| 170 | + |
| 171 | +```bash |
| 172 | +export PACT_CLI_EXTENSIONS_HOME=/opt/pact-extensions |
| 173 | +pact extension install pactflow-ai |
| 174 | +``` |
| 175 | + |
| 176 | +## 🔍 Version Management |
| 177 | + |
| 178 | +The extension system provides intelligent version tracking: |
| 179 | + |
| 180 | +### PactFlow AI Versions |
| 181 | + |
| 182 | +- **Installed Version**: Retrieved by executing `pactflow-ai --version` |
| 183 | +- **Latest Version**: Fetched from `https://download.pactflow.io/ai/dist/{platform}/latest` |
| 184 | +- **Manual Updates**: Use `pact extension update pactflow-ai` |
| 185 | + |
| 186 | +### Ruby Legacy Versions |
| 187 | + |
| 188 | +- **Installed Version**: Recorded during installation from GitHub release tag |
| 189 | +- **Latest Version**: Fetched from GitHub API `/repos/pact-foundation/pact-standalone/releases/latest` |
| 190 | +- **Manual Updates**: Use `pact extension update pact-ruby-standalone` |
| 191 | + |
| 192 | +## 🌍 Platform Support |
| 193 | + |
| 194 | +### PactFlow AI |
| 195 | + |
| 196 | +- **macOS**: Intel (x86_64) and Apple Silicon (aarch64) |
| 197 | +- **Linux**: x86_64 and aarch64 |
| 198 | +- **Windows**: x86_64 and aarch64 |
| 199 | + |
| 200 | +### Ruby Legacy Tools |
| 201 | + |
| 202 | +- **macOS**: Intel (x86_64) and Apple Silicon (aarch64) |
| 203 | +- **Linux**: x86_64 and aarch64 |
| 204 | +- **Windows**: x86_64 only |
| 205 | + |
| 206 | +## 🔗 Integration Examples |
| 207 | + |
| 208 | +### GitHub Actions |
| 209 | + |
| 210 | +```yaml |
| 211 | +# GitHub Actions example |
| 212 | +- uses: you54f/pact-cli@main |
| 213 | +- name: Install Pact Extensions |
| 214 | + run: | |
| 215 | + pact extension install pactflow-ai |
| 216 | + pact extension install pact-ruby-standalone |
| 217 | +- name: Or Install All Pact Extensions |
| 218 | + run: | |
| 219 | + pact extension install --all |
| 220 | +``` |
0 commit comments