# Command Line Interface

Manage automations, scripts, run tests, view logs, download, watch, publish and more from the command line.

## Commands

Type `mesa` to get a list of available commands:

```
mesa export
mesa push [params]
mesa pull [params]
mesa watch
mesa install [version]
mesa test
mesa replay mesa logs [-v] [-n 50]

Optional Parameters:
-e, --env [value] : Environment to use (filename in ./config/).
-a, --automation [value] : Automation key. Automatically determined by the mesa.json file if not specified.
-f, --force : Force, overwrite config for inputs/outputs/storage.
-n, --number [value] : Number.
-v, --verbose : Verbose: Show log metadata.
```

## Installing

With yarn

```
yarn global add mesa-cli
```

Or with NPM

```
npm install -g mesa-cli
```

## Upgrading

To upgrade to the latest version

```
yarn global upgrade mesa-cli@latest
```

## Configuring sites

Create a new directory with a config.yml file:

```yaml
uuid: mystoreuuid
key: J0lSB0PIuw145xhk610Ud6dLA7A****B7LnfUjaL
```

The config.yml file can be in your current working directory, or in `~/.mesa/config.yml` so you can run `mesa` from any working directory.

`uuid` is your myshopify.com subdomain: **UUID**.myshopify.com\
`key` is your site's MESA Key from the bottom of the Reports tab of the MESA Dashboard .\
Optional parameter: `api_url`.

### Specifying environments

* Delete your global `~/.mesa/config.yml` file
* Save configuration files in `~/.mesa/config`. For example: `~/.mesa/config/mystoreuuid.yml`
* Pass the environment with the `--env` or `-e` flags, or by setting the `ENV` envvar:

```
mesa watch --env mystoreuuid
mesa watch -e mystoreuuid
ENV=mystoreuuid
mesa watch export ENV=mystoreuuid && mesa watch
```

[Full details on usage](https://www.npmjs.com/package/config-yml)

## Editing Automations

To get started, export an automation to download the scripts and configuration into the current directory:

```
 mesa export <automationkey>
```

Then use the utility functions to keep your local code in sync with MESA:

```
mesa watch <...files>
mesa push <...files>
mesa pull <...files>
```

`<...files>` can be:

Specific path(s) to files: `tracktor/in-webhook.js tracktor/out-webhook.js`

Or for multiple files: `tracktor/*`

## Local development

To clone `mesa-cli` locally and install it globally:

```
git clone git@github.com:shoppad/mesa-cli.git
cd mesa-cli
yarn link
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getmesa.com/for-developers/command-line-interface.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
