# @anthill.technology/amplify-cli

> Command-Line Interface for Amplify

Latest version **1.1.0** (published 2024-01-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @anthill.technology/amplify-cli
pnpm add @anthill.technology/amplify-cli
yarn add @anthill.technology/amplify-cli
bun add @anthill.technology/amplify-cli
```

Provides the command `amplify`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2024-01-22 |
| First published | 2023-08-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=18 |
| Dependencies | 17 |
| Unpacked size | 75.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | anthill.technology |

## Links

- npm: https://www.npmjs.com/package/@anthill.technology/amplify-cli
- npm.io page: https://npm.io/package/@anthill.technology/amplify-cli

## Dependencies (17)

- [yn](https://npm.io/package/yn.md) ^4.0.0
- [ora](https://npm.io/package/ora.md) ^5.4.1
- [ably](https://npm.io/package/ably.md) ^1.2.45
- [open](https://npm.io/package/open.md) ^8.4.2
- [axios](https://npm.io/package/axios.md) ^1.5.1
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [dotenv](https://npm.io/package/dotenv.md) ^16.3.1
- [figlet](https://npm.io/package/figlet.md) ^1.6.0
- [prompts](https://npm.io/package/prompts.md) ^2.4.2
- [archiver](https://npm.io/package/archiver.md) ^6.0.1
- [auth0-js](https://npm.io/package/auth0-js.md) ^9.22.1
- [commander](https://npm.io/package/commander.md) ^11.0.0
- [cli-table3](https://npm.io/package/cli-table3.md) ^0.6.3
- [jwt-decode](https://npm.io/package/jwt-decode.md) ^3.1.2
- [configstore](https://npm.io/package/configstore.md) ^5.0.1
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^9.0.2
- [openid-client](https://npm.io/package/openid-client.md) ^5.5.0

## Recent versions

- 1.1.0 (latest) — 2024-01-22
- 1.0.1 — 2023-08-17
- 1.0.0 — 2023-08-10

## README

# Amplify CLI reference

The Amplify CLI is a command-line interface that provides a variety of tools for managing, viewing, and deploying plugins.

## Commands

The command `amplify --help` lists the available commands and `amplify <command> --help` shows more details for an individual command.

Below is a brief list of the available commands and their function:

```shell
   ____                                          _       _     _              ___       _             __                   __                 _                    _ _  __
  / ___|___  _ __ ___  _ __ ___   __ _ _ __   __| |     | |   (_)_ __   ___  |_ _|_ __ | |_ ___ _ __ / _| __ _  ___ ___   / _| ___  _ __     / \   _ __ ___  _ __ | (_)/ _|_   _
 | |   / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` |_____| |   | | '_ \ / _ \  | || '_ \| __/ _ \ '__| |_ / _` |/ __/ _ \ | |_ / _ \| '__|   / _ \ | '_ ` _ \| '_ \| | | |_| | | |
 | |__| (_) | | | | | | | | | | | (_| | | | | (_| |_____| |___| | | | |  __/  | || | | | ||  __/ |  |  _| (_| | (_|  __/ |  _| (_) | |     / ___ \| | | | | | |_) | | |  _| |_| |
  \____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|     |_____|_|_| |_|\___| |___|_| |_|\__\___|_|  |_|  \__,_|\___\___| |_|  \___/|_|    /_/   \_\_| |_| |_| .__/|_|_|_|  \__, |
                                                                                                                                                            |_|            |___/
Usage: amplify [options] [command]

Command-Line Interface for Amplify

Options:
  -V, --version            output the version number
  -h, --help               display help for command

Commands:
  login [options]          log the CLI into Amplify.
  logout                   log the CLI out of Amplify.
  use [options]            set an active organization for your working directory.
  plugin:create [options]  creates a new plugin in Amplify.
  plugin:deploy [options]  deploys a new plugin in Amplify.
  plugin:delete [options]  deletes a plugin from Amplify.
  plugin:list [options]    list the available plugins in Amplify.
  help [command]           display help for command
```

## Installation

[//]: # (### Install the Amplify CLI)

To download and install the Amplify CLI run the following command:
```
npm install -g @anthill.technology/amplify-cli
```
This will provide you with the globally accessible `amplify` command.

## Usage

### Log in the Amplify CLI

After installing the CLI, you must authenticate. Log into Amplify using your account by running the following command:
```
amplify login
```

Test that the CLI is properly installed and accessing your account by listing your organizations. Run the following command:
```
amplify use
```
You will be prompted to select an active organization. To change the active organization re-run the above command.

### List available plugins

To view existing plugins. Run the following command:
```
amplify plugin:list
```

### Create a new plugin

To create a new plugin. Run the following command:
```
amplify plugin:create
```
You will be prompted to select a plugin type, and a name for the plugin. A new directory will be created in your local path using the name of the plugin.

```
tree ./example-plugin

./example-plugin
├── config.js
├── index.js
└── package.json
```
The directory contains the following structure. For more information regarding supported schemas based on each plugin type, see [schemas](#schema).

### Deploy an existing plugin

To deploy a new plugin. Run the following command:
```
amplify plugin:deploy --directory <path-to-folder>
```
To redeploy an existing plugin, re-run the above command.

## Schema

### Config.js

Represents the configuration object of the Plugin, with an optional `settings` array.
```javascript
module.exports = {
  id: string,
  name: string,
  type: string,
  settings: [
    {
      id: string,
      required: boolean,
      type: string,
      label: string,
      hint: string,
    },
    {
      id: string,
      required: boolean,
      type: 'selectList',
      options: [
        { label: string, value: string },
        { label: string, value: string },
      ],
    },
  ],
};
```

- `id`: The unique identifier for the plugin (autogenerated from the `plugin:create` command).
- `name`: The display name of the plugin.
- `type`: The plugin type. Supported values are: `message`, `buttonGroup`, `carousel`, `embedded`, `goTo`, `question` and `player`
- `settings`: Variables that can be configured when the plugin is configured in the editor.
  - `id`: The key used to reference the setting.
  - `required`: If true then the settings must have a value.
  - `type`: Identifies what kind of input method the settings has. Supported values are `string`, `boolean` and `selectList`.
  - `options`: If the settings type is `selectList` then it is necessary to define the possible input values.
  - `label` (optional): The display name of the setting. If this isn't defined, then the `id` key will be used as the display name.
  - `hint` (optional): A descriptive hint to render with the plugin setting to explain what can be configured with it.


### Index.js

Based on the plugin type, the following schemas are required.

#### General setup of all types

The general setup of each plugin type is the following:
```javascript
exports.handler = async (params) => {
  return {
    type: '<NODE_TYPE>',
    delay: 2,
    ...
  };
};
```
Where the `params` object consists of:
- `params`: The available configration for the plugin.
  - `settings`: An object of the settings defined in `config.js` with their values defined by the editor in the builder.
  - `context`: All the storage values defined for the amp with their assigned value in the user's context.

And the `handler` method returns an object of the rendered node, which always (no matter which type of plugin it is) consists of:
- `type`: The type of node to be rendered.
- `delay`: How long a delay in seconds there should be for the node to be rendered (the chatbot renders a typing animating during the delay).

#### Message
```javascript
exports.handler = async (params) => {
  // ...
  return {
    type: 'message',
    delay: 1,
    html: '<html></html>',
  };
};
```


#### Button Group
```javascript
exports.handler = async (params) => {
  // ...
  return {
    type: 'buttonGroup',
    delay: 1,
    subNodes: {
      '<UUID>': {
        id: '<UUID>',
        sortIndex: 0,
        buttonTexts: ['Yes', 'No'],
      },
    },
  };
};
```

#### Carousel
```javascript
exports.handler = async (params) => {
  // ...
  return {
    type: 'carousel',
    delay: 1,
    subNodes: {
      '<UUID>': {
        id: '<UUID>',
        sortIndex: 0,
        headline: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
        description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vel nunc quis orci commodo laoreet sit amet ac odio.',
        email: {
          address: 'ullman@yahoo.com',
          subject: 'Lorem ipsum dolor sit amet',
          title: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
        },
        link: {
          title: 'Lorem Picsum',
          url: 'https://picsum.photos/200/300',
        },
        media: {
          title: 'Lorem Picsum',
          type: 'image',
          url: 'https://picsum.photos/200/300',
        },
      },
    },
  };
};
```

#### Embedded
```javascript
exports.handler = async (params) => {
  // ...
  return {
    type: 'embedded',
    delay: 1,
    title: 'Lorem ipsum',
    embedUrl: 'https://path.to.the.embedded.url',
    successMessageEvent: '<postMessage.success_event.name>',
    returnOnSuccess: false,
  };
};
```

#### Go To
```javascript
exports.handler = async (params) => {
  // ...
  return {
    type: 'goTo',
    delay: 1,
    conversationId: '<CONVERSATION_ID>,
  };
};
```

#### Question
```javascript
exports.handler = async (params) => {
  // ...
  return {
    type: 'question',
    delay: 1,
    html: '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>',
    buttonsDelay: 2,
    subNodes: {
      '<UUID>': {
        id: '<UUID>',
        sortIndex: 0,
        buttonTexts: ['Yes', 'No'],
      },
    },
  };
};
```

#### Player
```javascript
exports.handler = async (params) => {
  // ...
  return {
    type: 'player',
    delay: 1,
    media: {
      url: 'https://path.to.media.asset',
      title: 'media_file_name.mp3',
      type: 'audio',
    },
    headline: 'Lorem ipsum',
    description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
    autoPlay: false,
  };
};
```

---
_Source: https://npm.io/package/@anthill.technology/amplify-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
