Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .changeset/move-to-graphql-sdk.md

This file was deleted.

11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# @team-plain/cli

## 1.0.0

### Major Changes

- 1f7051a: Move to `@team-plain/graphql`, the replacement for the deprecated `@team-plain/typescript-sdk`.

- Requires Node.js 22.12 or later. Node.js 18 and 20 are end of life. To stay on them, pin `@team-plain/cli@0`.
- The API key needs the `knowledgeSource:create` permission. The README and `--help` previously said `indexedDocument:create`, which was wrong.
- Errors print as a single line, with the API error code where there is one, in place of the request ID.
- Passing more arguments than a command takes is now an error. `plain index-url a b` previously indexed `a` and ignored `b`.

## 0.4.0

### Minor Changes
Expand Down
60 changes: 39 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,65 @@
<div align="center">
<img src="./logo.png" alt="Plain" width="100px">
</div>

<!-- omit in toc -->
# @team-plain/cli

This CLI is used to interact with the Plain.com API.
CLI for interacting with the [Plain](https://www.plain.com) API.

Specifically for indexing content as
[Knowledge Sources](https://www.plain.com/docs/product/agents/knowledge-sources) in your Plain
workspaces, to be used by [Plain Agents](https://www.plain.com/docs/product/agents).

- [Installation](#installation)
- [Authentication](#authentication)
- [Commands](#commands)
- [Knowledge Sources](#knowledge-sources)
- [`index-url`](#index-url)
- [`index-sitemap`](#index-sitemap)
- [Running in CI](#running-in-ci)

If you run into any issues please open an issue or get in touch with us at [help@plain.com](mailto:help@plain.com).

## Installation

Requires Node.js 22.12 or later.

```
```bash
npm install -g @team-plain/cli
```

This installs the package globally and makes the `plain` command available in your path.

The cli has a help command that can be used to get more information about the available commands:

```
plain --help
```

## Authentication

To authenticate with your Plain workspace, the CLI uses a [Plain API Key](https://www.plain.com/docs/api-reference/graphql/authentication). The key is read from the environment variable `PLAIN_API_KEY`.
To authenticate with your Plain workspace, the CLI uses a
[Plain API Key](https://www.plain.com/docs/api-reference/graphql/authentication), read from the
`PLAIN_API_KEY` environment variable.

See below for permissions required for each command.

```
```bash
export PLAIN_API_KEY=plainApiKey_xxx
```

## Commands

### Knowledge Sources

These commands add pages to Plain as [knowledge sources](https://www.plain.com/docs/product/agents/knowledge-sources), which Ari uses to answer customers. Plain fetches and indexes the content of each URL. Running a command again for a URL that's already a knowledge source reindexes it.
Commands for indexing content as
[Knowledge Sources](https://www.plain.com/docs/product/agents/knowledge-sources) in your Plain
workspace, so that [Plain Agents](https://www.plain.com/docs/product/agents), such as
[Ari](https://www.plain.com/docs/product/agents/ari), can use it to answer customer questions and as
context.

Each command fetches and indexes the content of the provided URL or sitemap. Running a command again
for a URL or sitemap that's already a knowledge source reindexes it.

### `index-url`

Index a single page by URL.

Required permissions: `knowledgeSource:create`

```
plain index-url <url>
```bash
PLAIN_API_KEY=plainApiKey_xxx plain index-url <url>
```

Options:
Expand All @@ -56,17 +72,19 @@ Index all the urls in a given sitemap you provide.

Required permissions: `knowledgeSource:create`

```
plain index-sitemap <sitemap url>
```bash
PLAIN_API_KEY=plainApiKey_xxx plain index-sitemap <sitemap url>
```

Options:

- `-l, --labelTypeIds <labelTypeIds...>`: Array of label type IDs to associate with the indexed urls from the sitemap
- `-l, --labelTypeIds <labelTypeIds...>`: Array of label type IDs to associate with the indexed urls
from the sitemap

## Running in CI

Pin the major version so a future breaking release can't change your workflow unannounced. For example, to reindex your docs from GitHub Actions:
Use the CLI in your CI pipeline to index your content as Knowledge Sources, for example when you
publish new documentation to a Mintlify site.

```yaml
- uses: actions/setup-node@v7
Expand Down
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@team-plain/cli",
"private": false,
"version": "0.4.0",
"version": "1.0.0",
"description": "CLI for interacting with the Plain API",
"repository": {
"type": "git",
Expand Down
Loading