Commerce Layer CLI

The official Commerce Layer CLI which helps you to manage your Commerce Layer applications right from the terminal.

What is Commerce Layer?
Commerce Layer is a multi-market commerce API and order management system that lets you add global shopping capabilities to any website, mobile app, chatbot, wearable, voice, or IoT device, with ease. Compose your stack with the best-of-breed tools you already mastered and love. Make any experience shoppable, anywhere, through a blazing-fast, enterprise-grade, and secure API.
Table of contents
Installation
Run the command below to install the CLI using your favorite package manager:
npm install -g @commercelayer/cli
yarn global add @commercelayer/cli
More installation options, coming soon...
Usage
Installing the CLI provides access to the commercelayer, clayer, and cl command.
$ (commercelayer | clayer | cl) COMMAND
$ commercelayer (-v | version | --version) to check the version of the CLI you have installed.
$ commercelayer help [COMMAND]
or
$ commercelayer [COMMAND] (--help | -h) for detailed information about CLI commands.
Kindly check out this quick step-by-step example which will show you how to place an order using this CLI.
Commands
The Commerce Layer CLI supports the following commands:
commercelayer applications
Show a list of all (logged in) available CLI applications.
USAGE
$ commercelayer applications [-k integration|sales_channel|user] [--live | -m test|live] [-a <value> | --id
<value>] [-A core|provisioning | -o <value>] [-S]
FLAGS
-A, --api=<option> specific API application
<options: core|provisioning>
-S, --sort sort applications by Organization and Application name
-a, --alias=<value> the alias associated to the application
-k, --kind=<option> application kind
<options: integration|sales_channel|user>
-m, --mode=<option> execution mode
<options: test|live>
-o, --organization=<value> organization slug
--id=<value> application id
--live live execution mode
DESCRIPTION
show a list of all (logged in) available CLI applications
ALIASES
$ commercelayer app:list
$ commercelayer applications:list
$ commercelayer app:available
$ commercelayer applications:available
$ commercelayer apps
EXAMPLES
$ commercelayer applications
$ cl applications
See code: src/commands/applications/index.ts
commercelayer applications:add
Add a new Commerce Layer application to CLI config (application must be of kind 'integration' or 'sales_channel').
USAGE
$ commercelayer applications:add -a <value> [-o <value>] (-s <value> -i <value>) [-S <value>... ] [-e <value> -p
<value>]
FLAGS
-S, --scope=<value>... access token scope (market, stock location)
-a, --alias=<value> (required) the alias you want to associate to the application
-e, --email=<value> customer email
-i, --clientId=<value> (required) application client_id
-o, --organization=<value> organization slug
-p, --password=<value> customer secret password
-s, --clientSecret=<value> application client_secret
DESCRIPTION
add a new Commerce Layer application to CLI config (application must be of kind 'integration' or 'sales_channel')
ALIASES
$ commercelayer app:add
EXAMPLES
$ commercelayer applications:add -o <organizationSlug> -i <clientId> -s <clientSecret> -a <applicationAlias>
$ cl app:add -i <clientId> -s <clientSecret> -a <applicationAlias>
See code: src/commands/applications/add.ts
commercelayer applications:current
Show the current application.
USAGE
$ commercelayer applications:current [-j ]
FLAGS
-j, --json show info in JSON format
DESCRIPTION
show the current application
ALIASES
$ commercelayer app:current
EXAMPLES
$ commercelayer applications:current
$ commercelayer app:current --info
See code: src/commands/applications/current.ts
commercelayer applications:info
Show application details.
USAGE
$ commercelayer applications:info [-k integration|sales_channel|user] [--live | -m test|live] [-a <value> | --id
<value>] [-A core|provisioning | -o <value>] [-j]
FLAGS
-A, --api=<option> specific API application
<options: core|provisioning>
-a, --alias=<value> the alias associated to the application
-j, --json show info in JSON format
-k, --kind=<option> application kind
<options: integration|sales_channel|user>
-m, --mode=<option> execution mode
<options: test|live>
-o, --organization=<value> organization slug
--id=<value> application id
--live live execution mode
DESCRIPTION
show application details
ALIASES
$ commercelayer app:info
See code: src/commands/applications/info.ts
commercelayer applications:login
Execute login to a Commerce Layer application (application must be of kind 'integration' or 'sales_channel').
USAGE
$ commercelayer applications:login -a <value> [-o <value>] (-s <value> -i <value>) [-S <value>... ] [-e <value> -p
<value>]
FLAGS
-S, --scope=<value>... access token scope (market, stock location)
-a, --alias=<value> (required) the alias you want to associate to the application
-e, --email=<value> customer email
-i, --clientId=<value> (required) application client_id
-o, --organization=<value> organization slug
-p, --password=<value> customer secret password
-s, --clientSecret=<value> application client_secret
DESCRIPTION
execute login to a Commerce Layer application (application must be of kind 'integration' or 'sales_channel')
ALIASES
$ commercelayer app:login
$ commercelayer login
EXAMPLES
$ commercelayer applications:login -o <organizationSlug> -i <clientId> -s <clientSecret> -a <applicationAlias>
$ cl app:login -i <clientId> -s <clientSecret> -a <applicationAlias>
See code: src/commands/applications/login.ts
commercelayer applications:logout
Remove an application from CLI local configuration.
USAGE
$ commercelayer applications:logout [-k integration|sales_channel|user] [--live | -m test|live] [-a <value> | --id
<value>] [-A core|provisioning | -o <value>] [-r]
FLAGS
-A, --api=<option> specific API application
<options: core|provisioning>
-a, --alias=<value> the alias associated to the application
-k, --kind=<option> application kind
<options: integration|sales_channel|user>
-m, --mode=<option> execution mode
<options: test|live>
-o, --organization=<value> organization slug
-r, --revoke revoke current access token
--id=<value> application id
--live live execution mode
DESCRIPTION
remove an application from CLI local configuration
ALIASES
$ commercelayer app:logout
$ commercelayer app:remove
$ commercelayer applications:remove
$ commercelayer logout
See code: src/commands/applications/logout.ts
commercelayer applications:provisioning
Show all Provisioning applications.
USAGE
$ commercelayer applications:provisioning [-k integration|sales_channel|user] [--live | -m test|live] [-a <value> | --id
<value>] [-A core|provisioning | -o <value>] [-S]
FLAGS
-A, --api=<option> specific API application
<options: core|provisioning>
-S, --sort sort applications by Organization and Application name
-a, --alias=<value> the alias associated to the application
-k, --kind=<option> application kind
<options: integration|sales_channel|user>
-m, --mode=<option> execution mode
<options: test|live>
-o, --organization=<value> organization slug
--id=<value> application id
--live live execution mode
DESCRIPTION
show all Provisioning applications
ALIASES
$ commercelayer app:prov
$ commercelayer app:provisioning
$ commercelayer prov:apps
$ commercelayer prov:applications
EXAMPLES
$ commercelayer applications:provisioning
$ cl app:provisioning
$ cl prov:apps
See code: src/commands/applications/provisioning.ts
commercelayer applications:scope SCOPE
Switch scope of current application.
USAGE
$ commercelayer applications:scope SCOPE [-a <value>]
ARGUMENTS
SCOPE the application scope
FLAGS
-a, --alias=<value> the alias you want to associate to the application
DESCRIPTION
switch scope of current application
ALIASES
$ commercelayer app:scope
EXAMPLES
$ commercelayer applications:scope market:code:1234
$ cl app:scope market:id:aBcDeFgHij
See code: src/commands/applications/scope.ts
commercelayer applications:switch
Switch applications.
USAGE
$ commercelayer applications:switch [-k integration|sales_channel|user] [--live | -m test|live] [-a <value> | --id
<value>] [-A core|provisioning | -o <value>]
FLAGS
-A, --api=<option> specific API application
<options: core|provisioning>
-a, --alias=<value> the alias associated to the application
-k, --kind=<option> application kind
<options: integration|sales_channel|user>
-m, --mode=<option> execution mode
<options: test|live>
-o, --organization=<value> organization slug
--id=<value> application id
--live live execution mode
DESCRIPTION
switch applications
ALIASES
$ commercelayer app:switch
$ commercelayer app:use
See code: src/commands/applications/switch.ts
commercelayer autocomplete [SHELL]
Display autocomplete installation instructions.
USAGE
$ commercelayer autocomplete [SHELL] [-r]
ARGUMENTS
[SHELL] (zsh|bash|powershell) Shell type
FLAGS
-r, --refresh-cache Refresh cache (ignores displaying instructions)
DESCRIPTION
Display autocomplete installation instructions.
EXAMPLES
$ commercelayer autocomplete
$ commercelayer autocomplete bash
$ commercelayer autocomplete zsh
$ commercelayer autocomplete powershell
$ commercelayer autocomplete --refresh-cache
See code: @oclif/plugin-autocomplete
commercelayer cli:dir
Show working directories used by the cli.
USAGE
$ commercelayer cli:dir
DESCRIPTION
show working directories used by the cli
ALIASES
$ commercelayer dir
$ commercelayer paths
$ commercelayer cli:paths
EXAMPLES
cl cli:dir
See code: src/commands/cli/dir.ts
commercelayer cli:update
Update Commerce Layer CLI.
USAGE
$ commercelayer cli:update [-v <value>]
FLAGS
-v, --version=<value> update CLI to a specific version or tag
DESCRIPTION
Update Commerce Layer CLI
ALIASES
$ commercelayer upgrade
$ commercelayer latest
EXAMPLES
$ commercelayer cli:update --version=<version-or-tag>
See code: src/commands/cli/update.ts
commercelayer cli:version
Show installed version of Commerce Layer CLI.
USAGE
$ commercelayer cli:version [-p]
FLAGS
-p, --plugins show version of installed plugins
DESCRIPTION
Show installed version of Commerce Layer CLI
ALIASES
$ commercelayer version
EXAMPLES
$ commercelayer cli:version
See code: src/commands/cli/version.ts
commercelayer help [COMMAND]
Display help for commercelayer.
USAGE
$ commercelayer help [COMMAND...] [-n]
ARGUMENTS
[COMMAND...] Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for commercelayer.
See code: @oclif/plugin-help
commercelayer plugins
List installed plugins.
USAGE
$ commercelayer plugins [--json] [--core]
FLAGS
--core Show core plugins.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
List installed plugins.
EXAMPLES
$ commercelayer plugins
See code: @oclif/plugin-plugins
commercelayer plugins:available
Show all available Commerce Layer CLI plugins.
USAGE
$ commercelayer plugins:available [-S]
FLAGS
-S, --sort order by plugin name
DESCRIPTION
show all available Commerce Layer CLI plugins
EXAMPLES
$ commercelayer plugins:available
See code: src/commands/plugins/available.ts
commercelayer plugins:inspect PLUGIN...
Displays installation properties of a plugin.
USAGE
$ commercelayer plugins:inspect PLUGIN...
ARGUMENTS
PLUGIN... [default: .] Plugin to inspect.
FLAGS
-h, --help Show CLI help.
-v, --verbose
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Displays installation properties of a plugin.
EXAMPLES
$ commercelayer plugins:inspect myplugin
See code: @oclif/plugin-plugins
commercelayer plugins:install PLUGIN
Installs a plugin into commercelayer.
USAGE
$ commercelayer plugins:install PLUGIN... [--json] [-f] [-h] [-s | -v]
ARGUMENTS
PLUGIN... Plugin to install.
FLAGS
-f, --force Force npm to fetch remote resources even if a local copy exists on disk.
-h, --help Show CLI help.
-s, --silent Silences npm output.
-v, --verbose Show verbose npm output.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Installs a plugin into commercelayer.
Uses npm to install plugins.
Installation of a user-installed plugin will override a core plugin.
Use the COMMERCELAYER_NPM_LOG_LEVEL environment variable to set the npm loglevel.
Use the COMMERCELAYER_NPM_REGISTRY environment variable to set the npm registry.
ALIASES
$ commercelayer plugins:add
EXAMPLES
Install a plugin from npm registry.
$ commercelayer plugins:install myplugin
Install a plugin from a github url.
$ commercelayer plugins:install https://github.com/someuser/someplugin
Install a plugin from a github slug.
$ commercelayer plugins:install someuser/someplugin
See code: @oclif/plugin-plugins
commercelayer plugins:latest [PLUGIN]
Show latest version of available plugins.
USAGE
$ commercelayer plugins:latest [PLUGIN] [-b]
ARGUMENTS
[PLUGIN] the name of the plugin
FLAGS
-b, --beta retrieve latest version from beta channel
DESCRIPTION
show latest version of available plugins
EXAMPLES
$ commercelayer plugins:latest
$ cl plugins:latest resources
See code: src/commands/plugins/latest.ts
commercelayer plugins:link PATH
Links a plugin into the CLI for development.
USAGE
$ commercelayer plugins:link PATH [-h] [--install] [-v]
ARGUMENTS
PATH [default: .] path to plugin
FLAGS
-h, --help Show CLI help.
-v, --verbose
--[no-]install Install dependencies after linking the plugin.
DESCRIPTION
Links a plugin into the CLI for development.
Installation of a linked plugin will override a user-installed or core plugin.
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
command will override the user-installed or core plugin implementation. This is useful for development work.
EXAMPLES
$ commercelayer plugins:link myplugin
See code: @oclif/plugin-plugins
commercelayer plugins:reset
Remove all user-installed and linked plugins.
USAGE
$ commercelayer plugins:reset [--hard] [--reinstall]
FLAGS
--hard Delete node_modules and package manager related files in addition to uninstalling plugins.
--reinstall Reinstall all plugins after uninstalling.
See code: @oclif/plugin-plugins
commercelayer plugins:uninstall [PLUGIN]
Removes a plugin from the CLI.
USAGE
$ commercelayer plugins:uninstall [PLUGIN...] [-h] [-v]
ARGUMENTS
[PLUGIN...] plugin to uninstall
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Removes a plugin from the CLI.
ALIASES
$ commercelayer plugins:unlink
$ commercelayer plugins:remove
EXAMPLES
$ commercelayer plugins:uninstall myplugin
See code: @oclif/plugin-plugins
commercelayer plugins:update
Update installed plugins.
USAGE
$ commercelayer plugins:update [-h] [-v]
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Update installed plugins.
See code: @oclif/plugin-plugins
Plugins
The Commerce Layer CLI currently supports the following plugins:
resources - Execute CRUD operations on API resources.
seeder - Execute Commerce Layer seeder.
imports - Import resources in Commerce Layer.
webhooks - Manage webhooks in Commerce Layer.
orders - Execute actions on orders in Commerce Layer.
checkout - Generate checkout URLs.
triggers - Execute actions on resources in Commerce Layer.
token - Manage Commerce Layer access tokens.
microstore - Generate Microstore URLs.
exports - Export resources from Commerce Layer.
cleanups - Cleanup resources from Commerce Layer.
tags - Manage resources tags in Commerce Layer.
provisioning - Make requests to Commerce Layer's Provisioning API.
links - Generate short links for shoppable resources.
metrics - Make requests to Commerce Layer's Metrics API.
You can run the command below to get a list of all available CLI plugins:
commercelayer plugins:available
You can run the command below to update all available CLI plugins:
commercelayer plugins:update
Contributors Guide
-
Fork this repository (learn how to do this here).
-
Clone the forked repository like so:
git clone https://github.com/<your username>/commercelayer-cli.git && cd commercelayer-cli
-
Make your changes and create a pull request (learn how to do this).
-
Someone will attend to your pull request and provide some feedback.
Need help?
License
This repository is published under the MIT license.