# Arc XP CLI

Source: https://dev.arcxp.com/arcxp-cli/

The Arc XP CLI is your command center for streamlining development and automating key workflows. Accelerate engineering tasks by executing processes directly from the command line using the new @arcxp/cli npm package.

The [Arc XP CLI](https://www.npmjs.com/package/@arcxp/cli) is your command center for streamlining development and automating key workflows. Accelerate engineering tasks by executing processes directly from the command line using the new `@arcxp/cli` npm package.

You can use the CLI to manage processes for products such as IFX, Themes, PageBuilder, Subscriptions, and more.

> **Note:**
> 
> Product specific documentation:
> 
> - [IFX Integration Management](https://www.npmjs.com/package/@arcxp/cli#arcxp-ifx)
> - [PageBuilder Engine Logs](https://dev.arcxp.com/pagebuilder-engine/developer-docs/pagebuilder-engine-logs-cli/)
> - [Themes Settings Management](https://dev.arcxp.com/themes/how-to-guides/themes-cli-package/)
> - [Subscriptions](https://dev.arcxp.com/subscriptions/getting-started/arc-xp-cli-subscriptions/)

## Setup

> **Caution:**
> 
> These instructions are written based on the latest version of the [npm package](https://www.npmjs.com/package/@arcxp/cli). Be sure your local install has the latest version.

1. On your local machine, install the package globally `npm i -g @arcxp/cli`  
If you get an error like `npm package "cli" does not exist...`,  
![NPM error](https://dev.arcxp.com/images/ifx/npm-error.png)  
ensure you have the following in your `.npmrc`:  
    
\~/.npmrc  
```bash
@arcxp:registry=https://registry.npmjs.org/
```

If you are still having issues, visit <https://docs.npmjs.com/getting-started> for help.
2. Create a file to store your authentication variables. Options for storage location **in order of priority**:  
> **Important:**  
>  
> Note that the **priority** for these files has changed as of version 1.2.0 in order to have a smoother experience when developing Themes Blocks. The CLI will look for Option 1 first, then continue down.

  - **Option 1:**  
  Create a file in your local working directory to store the variables `vim .env`
  - **Option 2:**  
  Add a file to your home directory to store the variables `vim ~/.env`
  - **Option 3:**  
  Create an Arc-specific directory to store the variables `mkdir ~/.arcxp-cli && vim ~/.arcxp-cli/.env`  
    
Add the variables to the file as shown below. You can swap environments by changing which variables are commented out:  
Terminal window  
```bash
# sandbox
CONTENT_BASE=https://api.sandbox.{org}.arcpublishing.com
ARC_ACCESS_TOKEN={yourToken}
# prod
# CONTENT_BASE=https://api.{org}.arcpublishing.com
# ARC_ACCESS_TOKEN={yourToken}
```
3. Run `arcxp` to confirm the package is running as expected. You should see a prompt for selecting a product. Choose the desired product and follow the prompts.

From here, you can run the CLI globally.

## Usage Modes

The CLI offers both script and interactive modes.

### Interactive Mode

Interactive mode will guide you through each command and prompt you with questions to input. Run this mode by entering `arcxp` and then following the prompts.

### Script Mode

Use script mode by running `arcxp {productName} [command] [options]`. This can be useful for automating repetitive development tasks.
