# CLI

A CLI package to create, maintain, and publish javascript block projects to AppMachine Flutter applications.

Using the CLI package, you're able to connect a local javascript project to your AppMachine Project. The CLI provides multiple commands to create, maintain and publish new blocks.

## Installation[​](https://docs.appmachine.com/cli/getting-started#installation) <a href="#installation" id="installation"></a>

The CLI can be globally installed on your machine, so you can easily use it across projects.

**NPM**[**​**](https://docs.appmachine.com/cli/getting-started#npm)

```
npm install -g @myjsblock/cli
```

**Yarn**[**​**](https://docs.appmachine.com/cli/getting-started#yarn)

```
yarn global add @myjsblock/cli
```

## Usage[​](https://docs.appmachine.com/cli/getting-started#usage) <a href="#usage" id="usage"></a>

```
myjsblock [command] [options]
```

## Commands[​](https://docs.appmachine.com/cli/getting-started#commands) <a href="#commands" id="commands"></a>

#### Link command[​](https://docs.appmachine.com/cli/getting-started#link-command) <a href="#link-command" id="link-command"></a>

Links your local directory to a Block Project, saving a credentials file in your project root.

```
myjsblock link
```

#### Push command[​](https://docs.appmachine.com/cli/getting-started#push-command) <a href="#push-command" id="push-command"></a>

Push your local project to the AppMachine server.

```
myjsblock push
```

#### Help[​](https://docs.appmachine.com/cli/getting-started#help) <a href="#help" id="help"></a>

Displays helpful information for the available commands.

```
myjsblock help
```

#### Supported Options[​](https://docs.appmachine.com/cli/getting-started#supported-options) <a href="#supported-options" id="supported-options"></a>

```
--token       Block token for the AppMachine App.
--secret      A Secret to login to the AppMachine server.
--overwrite   Overwrites the credential and config files.
--help        Displays complete help for [cmd].
--debug       Helps debugging the CLI.
```

## Advanced[​](https://docs.appmachine.com/cli/getting-started#advanced) <a href="#advanced" id="advanced"></a>

#### Manual linking[​](https://docs.appmachine.com/cli/getting-started#manual-linking) <a href="#manual-linking" id="manual-linking"></a>

Instead of supplying the `--token` and `--secret` arguments, you may create a `myjsblock.credentials.json` file in your project directory.

This file should follow the following format, using your own [token and secret](/developers/javascript/cli/cli-token-and-secret.md):

```json
{  
    "token": "TJ9plldgQSL87dnK6ZIVpzTszlG3TPKo",  
    "secret": "ifb1kEBUYBJ17NSQWdBUNoTTU5O2d1jlTJ9plldgQSL87dnK6ZIVpzTszlG3TPKo"
}
```

#### **Git ignoring myjsblock.credentials.json**[**​**](https://docs.appmachine.com/cli/getting-started#git-ignoring-myjsblockcredentialsjson)

If you use a version control system like Git, make sure you add the `myjsblock.credentials.json` file to the `.gitignore` file. This will prevent it from being saved in version control and is a good security measure.

#### Config File[​](https://docs.appmachine.com/cli/getting-started#config-file) <a href="#config-file" id="config-file"></a>

Some advanced configuration requires a `myjsblock.config.json` file in your project directory. This enables you to change settings like `ouputDirectory` and `entryFile` for your project.

An example of such a file would be:

```json
{  
    "entryFile": "index.html",  
    "outputDirectory": "dist"
}
```

**Config Properties**[**​**](https://docs.appmachine.com/cli/getting-started#config-properties)

| Config Property | Type   | Default    |
| --------------- | ------ | ---------- |
| entryFile       | string | index.html |
| outputDirectory | string | dist       |

**Output Directory**[**​**](https://docs.appmachine.com/cli/getting-started#output-directory)

This changes the output directory for your project. The default value is `dist`. The contents of this directory will be uploaded to the server by the CLI.

## Issues & Bugs[​](https://docs.appmachine.com/cli/getting-started#issues--bugs) <a href="#issues--bugs" id="issues--bugs"></a>

If you run into issues or have a question, please open an issue [here](https://github.com/AppMachine/myjsblock-cli/issues).


---

# 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.appmachine.com/developers/javascript/cli.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.
