# CLI

CLI streamlines the process of setting up applications in a local development environment and facilitates the seamless deployment of post-development modifications on the platform. With just a few straightforward steps, users can easily configure new projects or work on existing ones.

### Prerequisites

Before starting to use the App Maker CLI, ensure that the following prerequisites are installed on your system:

* A [Node.js](https://nodejs.org/en) version between **18.x** and **22.x** must be installed on your system.
* To run the CLI installation command, `curl` must be installed and accessible on your system.

### Installation

Below is the command to install the CLI:

```sh
$ curl -s https://abp.akinon.net/api/public/cli.sh | bash
```

To install the custom version of the CLI, you can use the following command:

```sh
$ curl -s https://abp.akinon.net/api/public/cli.sh@<version> | bash
```

### Publishing Project

All processes, except for the Env. version, remain the same. Instead of specifying the Env. version, you will now need to input tags into the form for the Akinon repository.

{% hint style="warning" %}
To ensure accurate deployment, it's crucial to tag both the environment version and the project package thoroughly. For example, consider this format: `v2.3.2` represents the environment version, while `-build.1` signifies the steadily build number for the project package. This approach aligns well with semantic versioning principles.
{% endhint %}

The tagging process is carried out as follows:

Desired changes that need to be sent are added to the git stage either individually or in bulk. Below, an explanation of the bulk submission method is provided.

```
git add.
git commit -m "new feature"
```

A tag is assigned for deployment:

```
git tag <tag>
```

{% hint style="warning" %}
There is no predefined structure for the tag format. You have the flexibility to define it according to your own development practices.
{% endhint %}

Finally, the tagged changes are pushed to the repository:

```
git push akinon main --tags
```

{% hint style="warning" %}
We assume that your remote repository is named `akinon` and the main branch is `main`. If your remote repository uses a different name or branch, please adjust the command accordingly.
{% endhint %}

### Command List

The following are the primary commands of the tool that act as a wizard during development processes:

<table><thead><tr><th width="246.921875">Command</th><th>Action</th></tr></thead><tbody><tr><td><code>login</code></td><td>Log in to the App Maker platform.</td></tr><tr><td><code>logout</code></td><td>Log out from the App Maker platform.</td></tr><tr><td><code>update</code></td><td>Update the App Maker CLI to the latest version.</td></tr><tr><td><code>project --help</code></td><td>Access project-specific commands.</td></tr><tr><td><code>project create</code></td><td>Create a new project using the default template.</td></tr><tr><td><code>project install</code></td><td>Perform a native installation for an existing project.</td></tr><tr><td><code>project upgrade</code></td><td>Upgrade the current environment version of the project to a new one.</td></tr><tr><td><code>project info</code></td><td>Display the meta information of the project.</td></tr><tr><td><code>project run</code></td><td>Run the application on a specific platform.</td></tr><tr><td><code>project diff &#x3C;platform></code></td><td>View changes in the native environment.</td></tr><tr><td><code>project reset &#x3C;platform></code></td><td>Undo changes made in the native environment of the project.</td></tr><tr><td><code>project list</code></td><td>List all projects in the current organization.</td></tr><tr><td><code>plugin --help</code></td><td>Access plugin-specific commands.</td></tr><tr><td><code>plugin add &#x3C;name></code></td><td>Add a plugin to the project. Remember to run <code>project install</code> afterward.</td></tr><tr><td><code>plugin create</code></td><td>Create boilerplate code to develop a plugin.</td></tr><tr><td><code>plugin pack</code></td><td>Package a plugin for publishing on App Maker.</td></tr><tr><td><code>plugin publish</code></td><td>Publishes a plugin on App Maker.</td></tr><tr><td><code>plugin unpublish</code></td><td>Unpublishes a plugin from App Maker.</td></tr><tr><td><code>plugin preview</code></td><td>Preview the potential effects of native configurations.</td></tr><tr><td><code>plugin run</code></td><td>Apply changes permanently.</td></tr><tr><td><code>plugin list</code></td><td>List all plugins in the current organization.</td></tr><tr><td><code>config pm</code></td><td>Change the package manager (yarn, npm).</td></tr><tr><td><code>config show</code></td><td>Display config details for App Maker.</td></tr><tr><td><code>git connect</code></td><td>Connect to your git repository.</td></tr><tr><td><code>git disconnect</code></td><td>Disconnect from your git repository.</td></tr><tr><td><code>git check</code></td><td>Check your git configs.</td></tr><tr><td><code>publickey add</code></td><td>Add a public key to access the repositories.</td></tr><tr><td><code>publickey list</code></td><td>Display a list of your public keys.</td></tr><tr><td><code>publickey remove</code></td><td>Remove one of your public keys.</td></tr></tbody></table>

***

### `login`

Log in to the App Maker platform.

**Example**

```sh
$ appmaker login
```

***

### `logout`

Safely log out of the CLI.

**Example**

```sh
$ appmaker logout
```

***

### `project create`

Creates a new project within the current directory, using the default App Maker template.

**Example:**

```sh
$ appmaker project create
```

{% hint style="warning" %}
To deploy this new application, it needs to be published on the platform.
{% endhint %}

**Options**

| Name          | Type  | Default          | Description                                                                     |
| ------------- | ----- | ---------------- | ------------------------------------------------------------------------------- |
| `--platforms` | array | `ios`, `android` | This specifies the target platform(s) to be built. (`ios`, `android`, `huawei`) |

{% hint style="warning" %}
If no `--platforms` option are specified, the default platforms will be set to `ios` and `android`.
{% endhint %}

**Example:**

```sh
$ appmaker project create --platforms android ios
```

OR

```sh
$ appmaker project create --platforms huawei
```

***

### `project install`

Performs a native setup on the application's project package, allowing the application to run.

**Example**

```sh
$ cd example-project-package
$ appmaker project install
```

**Options**

| Name                | Type    | Default          | Description                                                                     |
| ------------------- | ------- | ---------------- | ------------------------------------------------------------------------------- |
| `--exclude-plugins` | boolean | `false`          | Excludes previously added plugins from being used within the project.           |
| `--platforms`       | array   | `ios`, `android` | This specifies the target platform(s) to be built. (`ios`, `android`, `huawei`) |

{% hint style="warning" %}
If no `--platforms` option are specified, the default platforms will be set to `ios` and `android`.
{% endhint %}

**Example**

```sh
$ appmaker project install --exclude-plugins
```

OR

```sh
$ appmaker project install --platforms android huawei
```

***

### `project run`

Runs the application on a desired platform.

**Example:**

```sh
$ cd example-app
$ appmaker project run android
```

**Platforms**

| Name      | Description                         |
| --------- | ----------------------------------- |
| `ios`     | Run the project on iOS.             |
| `android` | Runs the project on Android.        |
| `huawei`  | Runs the project on Android Huawei. |
| `start`   | Runs the development server.        |

***

### `project upgrade`

Upgrades the project's current environment version to a newer one.

**Example:**

```sh
$ cd example-app
$ appmaker project upgrade
```

**Options**

| Name          | Type  | Default          | Description                                                                     |
| ------------- | ----- | ---------------- | ------------------------------------------------------------------------------- |
| `--platforms` | array | `ios`, `android` | This specifies the target platform(s) to be built. (`ios`, `android`, `huawei`) |

{% hint style="warning" %}
If no `--platforms` option are specified, the default platforms will be set to `ios` and `android`.
{% endhint %}

### Upgrading Project

When the command is run, it performs a version check by referencing the value in the "envVersion" field within the **akinon.json** file. Regardless of whether the application has been published or not, the command proceeds to complete the process based on the following rules:

* **If there is no new version available**, the command concludes by displaying a message indicating that the application is up-to-date.
* **If a new version is available;**
  * If the published version is on the level of minor `(v0.*.0)` or minor `(v0.0.*)`, the project automatically initiates the upgrading process.
  * If the published version is on the level of major `(v*.0.0)`, the process continues in an interactive manner.

***

### `project info`

Displays the meta information of the project.

**Example**

```sh
$ cd example-app
$ appmaker project info
```

***

### `project diff <platform>`

Displays the differences in the project's native environment, presented in a before/after format.

{% hint style="warning" %}
Users have the option to undo these changes using the `project reset` command.
{% endhint %}

**Example**

```sh
$ cd example-app
$ appmaker project diff ios
```

**Sample Output**

```xml
--- a/Info.plist
+++ b/Info.plist
@@ -60,6 +60,6 @@
        <key>UIViewControllerBasedStatusBarAppearance</key>
        <false/>
        <key>UIUserInterfaceStyle</key>
-       <string>Light</string>
+       <string>Dark</string>
 </dict>
 </plist>
```

{% hint style="warning" %}
This feature can only be used on the iOS platform.
{% endhint %}

***

### `project reset <platform>`

Reverts the changes made in the native environment of the project.

```sh
$ cd example-app
$ appmaker project reset ios
```

{% hint style="warning" %}
This feature can only be used on the iOS platform.
{% endhint %}

***

### `plugin add <name>`

Adds a ready-to-use plugin to the project **(akinon.json)**. Once the plugin information is added, execute the command `appmaker project install` to automatically install the required JavaScript and native dependencies for the plugin. (It's important to note that the `project install` command needs to be manually triggered to complete the installation process.)

**Example**

```sh
$ cd example-app
$ appmaker plugin add example-plugin
```

**akinon.json:**

```json
{
  ...
  "plugins": {
    "example-plugin": {
      "version": "0.0.1", --> sample version
      "name": "example-plugin",
      "moduleName": "ExamplePlugin",
      "config": {}
    }
  }
  ...
}
```

{% hint style="warning" %}
If no specific version is mentioned in the command, the latest version number of the plugin will be added.
{% endhint %}

After that, run the command below:

```sh
$ appmaker project install
```

***

### Installing Plugins with a Specific Version

If a user wants to install a specific version of a plugin in their project, they need to follow this method:

```sh
$ appmaker plugin add example-plugin@1.2.3
```

**akinon.json**

```json
{
  ...
  "plugins": {
    "example-plugin": {
      "version": "1.2.3",
      ...
    }
  }
  ...
}
```

The user can specify one part of the version (e.g., `1.2`) during installation, and the installation process will automatically fetch and install the latest version for the remaining parts.

**Example:**

Let's assume the user wants to install the following versions of the plugin:

```
2.0.5
1.3.4
1.3.5
1.4.0
0.2.3
```

If the user wants to install the latest version (`1.3.5`) from those starting with `1.3.*`:

```sh
$ appmaker plugin add example-plugin@1.3
```

**akinon.json**

```json
{
  ...
  "plugins": {
    "example-plugin": {
      "version": "1.3.5",
      ...
    }
  }
  ...
}
```

Or, to install the latest version that starts with `1.*.*`:

```sh
$ appmaker plugin add example-plugin@1
```

**akinon.json**

```json
{
  ...
  "plugins": {
    "example-plugin": {
      "version": "1.4.0",
      ...
    }
  }
  ...
}
```

Afterward, the following command needs to be run.

```sh
$ appmaker project install
```

***

### `plugin create`

Sets up **plugin-boilerplate** under the `.plugins/` directory in order to develop a plugin from scratch.

**Example**

```sh
$ cd example-app
$ appmaker plugin create
$ ? Enter plugin name: my-first-plugin
```

{% hint style="warning" %}
The `plugin create` command works differently from the `project add` command. To use a previously created plugin within a project, it needs to be added separately using the `project add` command.
{% endhint %}

***

### `plugin pack`

Packs the plugin in a ready-to-publish manner and includes it in the root directory of the related plugin.

**Example**

```sh
$ cd example-app/.plugins/my-first-plugin
$ appmaker plugin pack
```

To specify a new version before packaging, users can use the options that correspond to practices of [semantic version](https://semver.org/#summary).

**SemVer Options**

| Name      | Description              |
| --------- | ------------------------ |
| `--major` | Major `(1.3.4 -> 2.0.0)` |
| `--minor` | Minor `(0.1.1 -> 0.2.0)` |
| `--patch` | Patch `(0.0.1 -> 0.0.2)` |

**Example**

Assuming the current version is "0.0.1," when you run the following command:

```sh
$ appmaker plugin pack --patch
```

The output for the "example-app/.plugins/my-first-plugin/" directory will be as follows:

```
- my-first-plugin-0.0.2.tgz (npm)
- my-first-plugin-v0.0.2.tgz (yarn)
```

{% hint style="warning" %}
Each specified option will be applied to the "version" field of the **package.json** file.
{% endhint %}

***

### `plugin publish`

Uploads a packaged plugin to App Maker. Before publishing, the plugin needs to be packed using the "appmaker plugin pack" command.

{% hint style="warning" %}
Once a plugin is successfully published, the packaged version is deleted from the system.
{% endhint %}

**Example**

```sh
$ cd example-app/.plugins/my-first-plugin
$ appmaker plugin publish
```

{% hint style="warning" %}
If a `README.md` file exists in the plugin's root directory, its contents will be automatically submitted to the platform along with the plugin during the publishing process.
{% endhint %}

#### Plugin Publication Location

Published plugins are stored in the account of the organization to which you are connected on App Maker. To access all published plugins, users can visit App Maker and click on **Organization > Dependency Management**.

#### Plugin Access Permissions

Plugin access permissions are managed via the `private` parameter within the `package.json` file:

* Public Access (Default): Plugins are configured as `private: false` by default. In this state, the published plugins can be accessed and used by all organizations on App Maker.
* Private Access: If the configuration is set to `private: true`, the plugin becomes exclusive to the organization it belongs to. Other organizations will not be able to access or use these plugins.

***

### `plugin unpublish`

Unpublishes a specific version of a plugin from App Maker. This command is used to remove a previously published plugin version.

**Example**

```sh
$ appmaker plugin unpublish <plugin-name>@<version>
```

{% hint style="warning" %}
This command will permanently remove the specified plugin version from App Maker. Ensure that you want to unpublish it before executing this command.
{% endhint %}

### `plugin preview <platform>`

Allows to preview the potential impacts of native configurations ("ios", "android" and "huawei") made during the development of a plugin without affecting the default version.

**Example**

```sh
$ cd example-app
$ appmaker plugin preview ios
$ appmaker plugin preview android
$ appmaker plugin preview huawei
```

***

### `plugin run <platform>`

Permanently applies the changes from the output of the preview command to the project. It effectively sets up the plugin within the project, making it ready for the build process.

**Example**

```sh
$ cd example-app
$ appmaker plugin run ios
$ appmaker plugin run android
$ appmaker plugin run huawei
```

***

### `config show`

Displays the global config information.

**Example:**

```sh
$ appmaker config show
```

***

### `config pm`

Changes your package manager. It shows list of package managers (yarn, npm)

**Example:**

```sh
$ appmaker config pm
```

***

### `plugin publish`

Enables users to upload a packaged plugin to App Maker. Prior to publishing a plugin, it must be packed using the `appmaker plugin pack` command.

{% hint style="warning" %}
Once successfully published, the packaged version of the plugin is automatically deleted from the system. A readme file will be automatically included and packaged along with the plugin's own files.
{% endhint %}

***

### `publickey add`

This command initiates a prompt requesting the user to select an SSH public key that generated before in the `~/.ssh/` directory. It expects a valid SSH Public Key to be provided, and an error will occur if one is not entered.

{% hint style="warning" %}
Users can only add up to **5** SSH Public Keys and, these keys must be of the **RSA** type.
{% endhint %}

**Example:**

```sh
$ appmaker publickey add
```

***

### `publickey list`

Displays a table listing the SSH Public Keys.

**Example:**

```sh
$ appmaker publickey list
```

***

### `publickey remove`

Displays a list of the user's SSH keys, and the user can select and delete a key of their choice.

{% hint style="warning" %}
If the user does not have any SSH public keys, the program will display an error message.
{% endhint %}

**Example:**

```sh
$ appmaker publickey remove
```

***

### `git connect`

This command facilitates the interactive connection of a project to a managed git repository hosted on `amazon-codecommit`. It assists in configuring necessary settings, including SSH keys, repository details, and more.

**Example:**

```sh
$ appmaker git connect
```

{% hint style="warning" %}
You can also connect multiple public keys to a single project in your local environment.
{% endhint %}

***

### `git check`

Performs the following checks:

* Is CodeCommit's host information added to the **SSH Config** file?
* Is CodeCommit host information added to the SSH **known\_hosts** file?

**If run from within the project, it also verifies the following:**

* Has git init been used for the project?
* Have Akinon remote URLs been added?

If everything is in order, it will display:

```
Everything is OK!
```

If not, it will display:

```
Please run the "git connect" command.
```

**Example:**

```sh
$ appmaker git check
```

***

### `git disconnect`

This command facilitates the interactive disconnection of a project from a managed git repository. It performs the following actions:

* Deletes specific GIT configurations.

**If executed from within the project, it also:**

* Deletes the Akinon repository's remote URL.

As a result, the following message will be displayed:

```
Project and system disconnected from the managed git repository.
```

**Example:**

```sh
$ appmaker git disconnect
```


---

# 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.akinon.com/technical-guides/app-maker/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.
