# @xyo-network/xl1-cli

[![logo][]](https://xyo.network)

[![npm-badge][]][npm-link]
[![npm-downloads-badge][]][npm-link]
[![jsdelivr-badge][]][jsdelivr-link]
[![npm-license-badge][]](LICENSE)
[![socket-badge][]][socket-link]

XYO Layer One CLI

## Description

The XL1 Command-Line Interface (CLI) tool is a program you run in your terminal to create a local XL1 Node. Once installed, you can invoke it from any directory using its name, the command, and any desired options like:
```
xl1 <command> [options]
```
To see a list of all available commands and options run

```
xl1 --help
```

## Installation

### Prerequisites

This CLI tool is built with Node.js, which is required to run the application. Node.js provides the runtime environment for executing JavaScript outside the browser allowing this CLI to function as a standalone executable on your system.

#### Install Node.js

To get started, install the latest Long-Term Support (LTS) version of Node.js, which includes Node Package Manager (npm) from the [official site](https://nodejs.org/en/download). After installation, you can verify Node.js is working by running the following in your terminal:

```
node -v
npm -v
```

Once Node.js is installed, you can install the XL1 CLI tool globally using npm or yarn.

### Install the XL1 CLI

Once Node.js is installed, you can install the XL1 CLI tool globally using npm:

```
npm install -g @xyo-network/xl1-cli
```

This makes the command `xl1` available anywhere in your terminal.

You can run the following command to verify the XL1 CLI was installed correctly

```
xl1 --help
```

## Usage

After installing, you can run `xl1` from any terminal:

```
xl1
```

Runs a full XL1 Node, including both the API and Producer components. This is the default behavior when no subcommand is specified.

```
xl1 api
```

Starts only the API Node, which handles external requests and exposes HTTP endpoints.

```
xl1 producer
```

Starts only the Producer Node, which is responsible for block production.

Use `xl1 --help` for available options and configuration flags.

### Configuration

Certainly! Here’s a brief and well-organized section describing the three ways to configure your xl1 CLI tool:

⸻

Configuration

You can configure xl1 using CLI flags, environment variables, or a configuration file. All methods are optional and can be combined—CLI flags override environment variables, which override config file values.

#### CLI Flags

Pass options directly when running a command. For example:

```
xl1 --logLevel=info --api.port=8080
```

#### Environment Variables

Set configuration via environment variables before running the command:

```
export XL1_LOG_LEVEL=info
export XL1_API__PORT=8080
xl1
```

#### Config File

Create a `xyo.config.json` (or .js, .yaml) file in the working directory to define default settings:

```
{
  "logLevel": "info"
  "api": {
    "port": 8080,
  }
}
```



## Maintainers

-   [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
-   [Matt Jones](https://github.com/jonesmac)
-   [Joel Carter](https://github.com/JoelBCarter)
-   [Jordan Trouw](https://github.com/jordantrouw)

## License

> See the [LICENSE](LICENSE) file for license details

## Credits

[Made with 🔥 and ❄️ by XYO](https://xyo.network)

[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png

[npm-badge]: https://img.shields.io/npm/v/@xyo-network/xl1-cli.svg
[npm-link]: https://www.npmjs.com/package/@xyo-network/xl1-cli

[npm-downloads-badge]: https://img.shields.io/npm/dw/@xyo-network/xl1-cli
[npm-license-badge]: https://img.shields.io/npm/l/@xyo-network/xl1-cli

[jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xyo-network/xl1-cli/badge
[jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xyo-network/xl1-cli

[socket-badge]: https://socket.dev/api/badge/npm/package/@xyo-network/xl1-cli
[socket-link]: https://socket.dev/npm/package/@xyo-network/xl1-cli