Skip to content

Commit

Permalink
Merge pull request #296 from pactflow/feat/ai-beta-docs
Browse files Browse the repository at this point in the history
feat: initial ai docs
  • Loading branch information
mefellows authored Aug 20, 2024
2 parents d8fe9a7 + 10c705d commit b6f5900
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 0 deletions.
69 changes: 69 additions & 0 deletions website/docs/docs/ai/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: PactFlow AI
sidebar_label: AI
---

import { AiDownloadTable } from "../../../src/components/index";

:::note
The PactFlow AI feature is currently in closed beta and is available only to select customers who have joined the [waitlist](https://pactflow.io/ai/). If you’re interested in participating, please [register here](https://pactflow.io/ai/).
:::

## Prerequisites

1. A PactFlow cloud account (you can create a [free account here](https://pactflow.io/try-for-free/))
2. AI feature enabled on your account by SmartBear

## Installation

For *nix users (including Windows users running WSL), use the following command to download and install:

```
curl https://download.pactflow.io/ai/get.sh | sh
```

Verify the installation by running `pactflow-ai` to ensure it executes successfully.

### Manual installation

Alternatively, download the latest version for your operating system and architecture from the table below. Remember to add it to your environment's `PATH`:

<AiDownloadTable />

## Usage

Running `pactflow-ai --help` will give you the detailed usage for any of the subcommands.

### Authentication

Authentication requires valid PactFlow API Tokens, which can be obtained from the `Settings > Tokens` [page](/docs/user-interface/settings/api-tokens) of your PactFlow account.

There are several ways to authenticate with the CLI:

#### Environment Variables

Export the following environment variables, and the CLI will use these credentials to communicate with PactFlow:

```
export PACT_BROKER_BASE_URL="https://YOUR_ACCOUNT.pactflow.io"
export PACT_BROKER_TOKEN="YOUR_TOKEN"
```

#### Local configuration file

You can also configure the CLI using the following commands:

```
pactflow-ai config set url https://YOUR_ACCOUNT.pactflow.io
pactflow-ai config set token YOUR_TOKEN
```

This will create a `.pactflow.toml` file, which should be added to your `.gitignore`.

#### User configuration file

Alternatively, the user configuration file can be stored in a configuration directory for PactFlow. The paths are `~/.config/pactflow/config.toml` on Unix, and `%APPDATA%\pactflow\config.toml` on Windows.

## Getting help and providing feedback

For feedback, feature requests, or assistance with the tool, please contact the email address provided when you were granted access. For support unrelated to the AI feature, please follow the [usual methods](https://support.smartbear.com/pactflow/message/).
78 changes: 78 additions & 0 deletions website/src/components/AiDownloadTable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import React from "react";

const downloadBaseURL = "https://download.pactflow.io/ai/dist"

const redirectDownload = (osarch, filename) => {
fetch(`${downloadBaseURL}/${osarch}/latest`)
.then((res) => res.blob())
.then((res) => res.text())
.then((v) => v.trim())
.then((v) => {console.log(`Latest version of CLI: ${v}, downloading for ${osarch}/${filename}`); return v})
.then((version) => {
console.info(`downloading file: ${downloadBaseURL}/${osarch}/${version}/${filename}`)
var a = document.createElement('a');
a.href = `${downloadBaseURL}/${osarch}/${version}/${filename}`;
a.download = filename;
document.body.appendChild(a); // we need to append the element to the dom -> otherwise it will not work in firefox
a.click();
a.remove(); //afterwards we remove the element again
})
}
// our .dev specific react-table
const AiDownloadTable = () => {
return (
<table>
<thead>
<tr>
<th>OS</th>
<th>Architecture</th>
<th>Link</th>
</tr>
</thead>
<tbody>
<tr>
<td>Apple Darwin</td>
<td>aarch64</td>
<td><button onClick={() => redirectDownload("aarch64-apple-darwin", "pactflow-ai")}>download</button></td>
</tr>
<tr>
<td>Apple Darwin</td>
<td>x86_64</td>
<td><button onClick={() => redirectDownload("x86_64-apple-darwin", "pactflow-ai")}>download</button></td>
</tr>
<tr>
<td>Windows MSVC</td>
<td>x86_64</td>
<td><button onClick={() => redirectDownload("x86_64-pc-windows-msvc", "pactflow-ai.exe")}>download</button></td>
</tr>
<tr>
<td>Windows MSVC</td>
<td>aarch64</td>
<td><button onClick={() => redirectDownload("aarch64-pc-windows-msvc", "pactflow-ai.exe")}>download</button></td>
</tr>
<tr>
<td>Linux GNU</td>
<td>x86_64</td>
<td><button onClick={() => redirectDownload("x86_64-unknown-linux-gnu", "pactflow-ai")}>download</button></td>
</tr>
<tr>
<td>Linux MUSL</td>
<td>x86_64</td>
<td><button onClick={() => redirectDownload("x86_64-unknown-linux-musl", "pactflow-ai")}>download</button></td>
</tr>
<tr>
<td>Linux GNU</td>
<td>aarch64</td>
<td><button onClick={() => redirectDownload("aarch64-unknown-linux-gnu", "pactflow-ai")}>download</button></td>
</tr>
<tr>
<td>Linux MUSL</td>
<td>aarch64</td>
<td><button onClick={() => redirectDownload("aarch64-unknown-linux-musl", "pactflow-ai")}>download</button></td>
</tr>
</tbody>
</table>
);
};

export default AiDownloadTable;
1 change: 1 addition & 0 deletions website/src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@


export { default as DataTable } from "./DataTable"
export { default as AiDownloadTable } from "./AiDownloadTable"

0 comments on commit b6f5900

Please sign in to comment.