Skip to main content

XMT CLI Reference

Introduction​

This guide covers only commands and flags relevant to XM Plugins from the eXtension Management Toolkit (XMT) command-line interface (CLI).

Review this guide for a higher-level view of XMT CLI commands, including installation instructions. For XMT Plugin commands look through this guide.

Plugins​

Plugins are used to plug into the XM Platform. Each Plugin is tied to a specific PluginType, which identifies the part of the XM Platform it extends. A Plugin always exists within an Extension.

Create a Plugin​

Syntax​

xmt create plugin [--name=NAME] [--type=PLUGIN_TYPE] [--path=FILEPATH]

Flags​


-n, --name=NAME

NAME of the new Plugin.


-p, --path=FILEPATH

The FILEPATH to an Extension directory. If no FILEPATH is provided, the current working directory will be used. If the FILEPATH is not within an Extension directory, the command will fail.


-t, --type=PLUGIN_TYPE

Specify which PLUGIN_TYPE to create. See PluginTypes for details.


y --yes

Skip all prompts and use default values. This flag should be used for automation use cases.


-l, --location=URL

The URL of the starter code package or plugin template.


Description​

Provisions a new Plugin within an existing Extension. It will also download and unpackage the scaffolding for the Plugin based on the provided PluginType.

After creating a Plugin you will be prompted to add a connection.

Examples​

The structure of Extension foo with workflows_task Plugin bar would have the following structure:

foo
├── assets
│   ├── images
│   │   └── logo.svg
│   └── translations
│   └── EN.json
├── manifest.json
└── plugins
└── bar
├── clean.js
├── config.json
├── package.json
├── postcss.config.js
├── public
│   ├── index.html
│   └── translations
│   └── EN.json
├── src
│   ├── index.html
│   ├── main.js
│   └── plugin-app
│   ├── plugin-app.js
│   ├── plugin-app.scss
│   └── task-fields-example.js
└── webpack.config.js

View Plugins​

Syntax​

xmt view plugins [--path=FILEPATH]

Flags​


-p, --path=FILEPATH

The FILEPATH to an Extension directory. If no FILEPATH is provided, the current working directory will be used. If the FILEPATH is not within an Extension directory, the command will fail.


-o, --output=FORMAT

The output FORMAT. json and table are supported. FORMAT defaults to table.


Description​

Displays all plugins in an extension with their names, types, tags, and credentials in your local directory.

Assign a Connection to a Plugin​

Syntax​

xmt assign connection [--path=FILEPATH]

Flags​


-p, --path=FILEPATH

The FILEPATH to an Extension directory. If no FILEPATH is provided, the current working directory will be used. If the FILEPATH is not within an Extension directory, the command will fail.


-y, --yes

Skip all prompts. This flag should be used for automation use cases.


--plugin=PLUGIN

The name of the plugin to assign the connection to. You can see available plugin names with xmt view plugins. Required when using --enabled.


-e, --enabled=ENABLED

Whether to enable or disable the connection for the plugin. Accepts: true/false, t/f. Required when using --plugin.


Description​

Initiates a prompt to enable or disable a connection for each installed Plugin within the Extension directory. If the Extension has no connections, you can create one with xmt create connection.

PluginTypes​

PluginTypes are tied to a specific component of the XM Platform a Plugin can extend. For example, an workflows_task PluginType is used specifically for extending a project's Workflows Tasks.

View PluginTypes​

Syntax​

xmt list plugintype

Description​

Retrieves a list of PluginTypes.

Examples​

$ xmt list plugintypes
+---------------+------------+--------------------------------+
| NAME | STATUS | DESCRIPTION |
+---------------+------------+--------------------------------+
| workflows_task | Production | Plugin for extending tasks in |
| | | the XM Workflows platform |
+---------------+------------+--------------------------------+

Logdrains​

Tail XM Functions Logs​

Syntax​

xmt create logdrain --local --organizations=ORGANIZATION [--extension=EXTENSION_ID]

Flags​


-l, --local

Start a local session to temporarily tail logs.


-o, --organizations=ORGANIZATION

ORGANIZATION to tail logs from. XM Functions triggered for this organization will have all logs also sent to terminal. If the local flag is provided, only a single organization can be specified.


-e, --extension=EXTENSION_ID

EXTENSION_ID associated with the team. If run within an Extension root directory, the default value is id in the manifest.json.


Description​

Starts a 15 minute log tailing session for the provided organization. Logs produced from XM Functions during this session will also be sent to your terminal automatically.

Create a logdrain​

Syntax​

xmt create logdrain --url=URL --organizations=ORGANIZATION [--extension=EXTENSION_ID]

Flags​


-u, --url

The HTTP/HTTPS Event Collector URL generated from a Log provider. This URL should respond to POST requests with each line of the request body containing a syslog formatted log. Basic authentication can be provided in the URL itself.


-o, --organizations=ORGANIZATION

ORGANIZATION(s) to tail logs from. XM Functions triggered for this organization will have all logs also sent to terminal. If providing multiple organizations, provide a comma separated list of brands (e.g. --organizations=brand1,brand2).


-e, --extension=EXTENSION_ID

EXTENSION_ID associated with the team. If run within an Extension root directory, the default value is id in the manifest.json.


Description​

Create a logdrain for your XM Function. Any logs produced by your XM Function for the provided organizations will be exported to the given URL. For help generating the URL, please consult your logging providers documentation to create an HTTP/HTTPS event collector (HEC).

View configured logdrains​

Syntax​

xmt view logdrains [--extension=EXTENSION_ID]

Flags​


-e, --extension=EXTENSION_ID

EXTENSION_ID associated with the team. If run within an Extension root directory, the default value is id in the manifest.json.


Description​

Lists the logdrains created for this Extension through xmt create logdrain.