Skip to content

Commit d0e9512

Browse files
authored
docs: code review (#411)
PACT-4401
1 parent 8184688 commit d0e9512

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

website/docs/docs/ai/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ PactFlow AI includes a suite of features to improve the efficiency and quality o
1212
* Generating Pact tests using various combinations of OpenAPI descriptions, code, or request-response pairs
1313
* Customizable prompts and test templates to tailor output to your specific needs
1414
* Seamless integration with PactFlow's Role-based Access Controls feature, enabling you to enforce and manage organizational policies
15-
* Code review (upcoming), enabling you to evaluate the quality of existing Pact tests and suggest best-practice improvements
15+
* Code review (beta), enabling you to evaluate the quality of existing Pact tests and suggest best-practice improvements
1616

1717
PactFlow AI is available as a CLI and supports the following programming languages:
1818

website/docs/docs/ai/using.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,46 @@ This would instruct the test generation process to read the file content and use
353353
* Use the PactV4 interface
354354
```
355355

356+
### Reviewing Pact Tests
357+
358+
Use the `pactflow-ai review` command to check an existing Pact test against best practices.
359+
360+
:::note
361+
This feature is currently in beta. Supported languages include JavaScript and Java.
362+
:::
363+
364+
```sh
365+
pactflow-ai review \
366+
--test ./src/api.pact.spec.ts \
367+
--code ./src/api.js \
368+
--code ./src/product.js
369+
```
370+
371+
#### Applying Changes
372+
373+
By default, the review command provides feedback and suggested changes without modifying files.
374+
375+
To apply the suggestions automatically, use the `--apply` flag:
376+
377+
```sh
378+
pactflow-ai review \
379+
--test ./test.js \
380+
--code ./src.js \
381+
--apply
382+
```
383+
384+
The command requires a clean Git state to avoid introducing irreversible changes. If the file is not part of a Git repository, or if it has uncommitted or staged changes, the command will fail.
385+
386+
To override this behavior, use one or more of the following flags:
387+
388+
- `--allow-no-vcs` – Allow editing files not tracked in a Git repository.
389+
- `--allow-dirty` – Allow changes to files with uncommitted modifications.
390+
- `--allow-staged` – Allow changes to files with staged but uncommitted changes.
391+
392+
:::tip
393+
Run `pactflow-ai review --help` to see all available options and usage examples.
394+
:::
395+
356396
## Best Practices
357397

358398
### 1. Check PactFlow's work

0 commit comments

Comments
 (0)