> ## Documentation Index
> Fetch the complete documentation index at: https://help.experro.com/llms.txt
> Use this file to discover all available pages before exploring further.

# About cli

Experro CLI is a command-line interface tool that you use to initialize environment file, fetch data from server, build, and deploy the theme.

## Installation

You are already familiar with the process of installing the CLI. For reference, here is the command to install the CLI:

```sh theme={null}
npm i -g experro-cli
```

After installation, you'll get `experro-cli` command in terminal.

Use the following command to show everything that's available:

```sh theme={null}
experro-cli --help
Usage:
  experro-cli [OPTIONS] <command>

Help Options:
  -h, --help  Show this help message

Available commands:
  build        Build the app
  environment  Environment related commands
  init         Init the project
  server       Start the local server
  version      Version creation
```

Some of the commands accept options. Option names are prefixed with double dash (`--`) characters. If options requires the value, it should be in `--option-name=value` format.

***

### Available Commands

## To use this commands you will need to have `CLI token` created, if you don't have CLI token, [Get CLI Token](https://help.experro.com/theme-development/experro-cli/get-cli-token.md).

> [!NOTE]
>
> #### `init`
>
> ***
>
> This command helps to create **.env**. This file will contain information for: \
> 1\. tenant-id \
> 2\. workspace-id \
> 3\. cli-token \
> 4\. store-url \
> &#x20;For more information you can use help command: `experro-cli init --help` \\
>
> ```sh theme={null}
> experro-cli init --cli-token='XXXXX' --tenant-id=<tenant-id> --workspace-id=<workspace-id> --store-url=<store-hase>.experro.app --api-host=apis.experro.app --channel_ids=<channel_id_1>,<channel_id_2>
> ```
>
> To obtain the required parameters, you can get it from the CLI token generated in the Experro Admin panel and set them in the `experro-cli init` command.

> [!NOTE]
>
> #### `environment`
>
> ***
>
> This command lists the list of environments in the specified workspace. The information is retrieved from the .env file, which has been created using the aforementioned command `experro-cli init <--content-->`. \
> &#x20;To list down the environment you can use the command: \
> &#x20;`experro-cli environment list`

> [!NOTE]
>
> #### `server`
>
> ***
>
> This command is useful to **start the local server**. It will help you fetch the data from Experro's live store. \
> &#x20;`experro-cli server start`

> [!NOTE]
>
> #### `version`
>
> ***
>
> It allows you to create, delete, list and publish version's of the themes. \
> &#x20;To know more you can use this command: \
> ` experro-cli version --help` \
> \
> &#x20;1\. Create version \
> 2\. Delete version \
> 3\. List version \
> 4\. Publish version \
> \\
>
> **1.  Create a version** : \
> To create a version, simply use the command as shown below. Just assigned values of the `--name` and `--environment-id` with your specific values, then execute this command. Your latest version will be created, and the build with the provided `--name` will be uploaded to the admin panel.
>
> ```sh theme={null}
> experro-cli version create --name=<theme-name/version-name> --environment-id=<environmnet-id>
> ```
>
> ![image.png](https://mintcdn.com/experro/-c3d2Mmp8bZuVNox/images/image-41.png?fit=max\&auto=format\&n=-c3d2Mmp8bZuVNox\&q=85\&s=fecddddd898cf7ce2ed4f61e8b6898cb)
>
> After successfully creating a version, you will see an output similar to the screenshot above.
>
> **Note:** \
> &#x20;After successfully creating a version, an `id` will be displayed in your terminal (as shown in the screenshot above). Make sure to save this `id` for future reference, as it will be required to publish the uploaded version or perform other actions using Experro-cli.
>
> **2.  Delete a version** :\
> &#x20;This option will helpful to delete a uploaded version. You just need to provide `--tenant-id` `--wrokspace-id` `--cli-token` and `--version-id`. Version-id will be same as we have seen in above command as below
>
> ```sh theme={null}
> experro-cli version delete --tenant-id=<tenent-id> --workspace-id=<workspace-id> --cli-token=<cli-token> --version-id=<version-id>
> ```
>
> **3.  List version**:\
> &#x20;The `list` option in the `version` command for `experro-cli` will display a list of all the versions that have been uploaded to the workspace. It will also show the status of each version, indicating which version is currently published.
>
> ```sh theme={null}
> experro-cli version list 
> ```
>
> **4.  Publish version**:\
> &#x20;Option `publish version` will allow theme-developer to direclty publish the version which is created using command as below
>
> ```sh theme={null}
> experro-cli version publish --tenant-id=<tenent-id> --workspace-id=<workspace-id> --cli-token=<cli-token> --environment-id=<environment-id> --version-id=<version-id>
> ```

> [!NOTE]
>
> #### `build`
>
> ***
>
> This command is useful for creating an optimized local build.
>
> ```sh theme={null}
>  experro-cli build --tenant-id=<tenent-id> --workspace-id=<workspace-id> --cli-token=<cli-token> --version-id=<version-id>
> ```

***

If you're facing any difficulties with the CLI, refer to the [Troubleshooting](https://help.experro.com/theme-development/experro-cli/troubleshotting.md) section of the documentation for possible solutions.

If you are facing any difficulties about CLI Token, then simply go ahead for [Get CLI Token](https://help.experro.com/theme-development/experro-cli/get-cli-token.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.