Skip to content

Commit 9a38529

Browse files
authored
Merge pull request #8 from YOU54F/feat/extensions
feat: add pactflow-ai / pact-ruby-standalone via extensions framework
2 parents f5327a5 + 80827c6 commit 9a38529

File tree

7 files changed

+1387
-14
lines changed

7 files changed

+1387
-14
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ include = [
2525
clap = { version = "4.5.2", features = ["derive", "env", "cargo"] }
2626
clap_complete = { version = "4.5.1", features = [] }
2727
home = "0.5.5"
28+
reqwest = { version = "0.12.24", features = ["json"] }
29+
serde = { version = "1.0.228", features = ["derive"] }
30+
serde_json = "1.0.145"
31+
comfy-table = "7.2.1"
2832

2933
# pact-stub-server = { version = "*", path = "/Users/saf/dev/pact-foundation/pact-stub-server"}
3034
# pact_mock_server_cli = { version = "2.0.0-beta.1", path = "/Users/saf/dev/pact-foundation/pact-core-mock-server/pact_mock_server_cli"}

EXTENSIONS.md

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
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+
```

README.md

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,41 @@ tags format
123123

124124
```console
125125
$ pact --help
126-
Pact consolidated CLI - pact_core_mock_server, pact_verifier, pact-stub-server, pact-plugin-cli, pact-broker-cli in a single binary
126+
127+
**Pact** is the de-facto API contract testing tool. Replace expensive and brittle end-to-end integration tests with fast, reliable and easy to debug unit tests.
128+
129+
Check out https://docs.pact.io
130+
131+
- ⚡ Lightning fast
132+
- 🎈 Effortless full-stack integration testing - from the front-end to the back-end
133+
- 🔌 Supports HTTP/REST and event-driven systems
134+
- 🛠️ Configurable mock server
135+
- 😌 Powerful matching rules prevents brittle tests
136+
- 🤝 Integrates with Pact Broker / PactFlow for powerful CI/CD workflows
137+
- 🔡 Supports 12+ languages
138+
139+
**Why use Pact?**
140+
141+
Contract testing with Pact lets you:
142+
143+
- ⚡ Test locally
144+
- 🚀 Deploy faster
145+
- ⬇️ Reduce the lead time for change
146+
- 💰 Reduce the cost of API integration testing
147+
- 💥 Prevent breaking changes
148+
- 🔎 Understand your system usage
149+
- 📃 Document your APIs for free
150+
- 🗄 Remove the need for complex data fixtures
151+
- 🤷 Reduce the reliance on complex test environments
152+
127153
128154
Usage: pact [OPTIONS] [COMMAND]
129155
130156
Commands:
131157
broker A Rust and CLI client for the Pact Broker. Publish and retrieve pacts and verification results.
132158
pactflow PactFlow specific commands
133159
completions Generates completion scripts for your shell
160+
extension Manage Pact CLI extensions
134161
plugin CLI utility for Pact plugins
135162
mock Standalone Pact mock server
136163
verifier Standalone pact verifier for provider pact verification
@@ -140,20 +167,38 @@ Commands:
140167
Options:
141168
--enable-otel
142169
Enable OpenTelemetry tracing
170+
143171
--enable-otel-logs
144172
Enable OpenTelemetry logging
173+
145174
--enable-otel-traces
146175
Enable OpenTelemetry traces
176+
147177
--otel-exporter <otel-exporter>
148-
The OpenTelemetry exporter(s) to use, comma separated (stdout, otlp) [env: OTEL_TRACES_EXPORTER=]
178+
The OpenTelemetry exporter(s) to use, comma separated (stdout, otlp)
179+
180+
[env: OTEL_TRACES_EXPORTER=]
181+
149182
--otel-exporter-endpoint <otel-exporter-endpoint>
150-
The endpoint to use for the OTLP exporter (required if --otel-exporter=otlp) [env: OTEL_EXPORTER_OTLP_ENDPOINT=]
183+
The endpoint to use for the OTLP exporter (required if --otel-exporter=otlp)
184+
185+
[env: OTEL_EXPORTER_OTLP_ENDPOINT=]
186+
151187
--otel-exporter-protocol <otel-exporter-protocol>
152-
The protocol to use for the OTLP exporter (http/protobuf, http) [env: OTEL_EXPORTER_OTLP_PROTOCOL=] [default: http] [possible values: http, http/protobuf]
188+
The protocol to use for the OTLP exporter (http/protobuf, http)
189+
190+
[env: OTEL_EXPORTER_OTLP_PROTOCOL=]
191+
[default: http]
192+
[possible values: http, http/protobuf]
193+
153194
--log-level <LEVEL>
154-
Set the log level (none, off, error, warn, info, debug, trace) [default: off] [possible values: off, none, error, warn, info, debug, trace]
195+
Set the log level (none, off, error, warn, info, debug, trace)
196+
197+
[default: off]
198+
[possible values: off, none, error, warn, info, debug, trace]
199+
155200
-h, --help
156-
Print help
201+
Print help (see a summary with '-h')
157202
158203
```
159204

0 commit comments

Comments
 (0)