GenLayer CLI

GenLayer CLI

The GenLayer CLI is a command-line interface designed to streamline the setup and local execution of the GenLayer simulator. It automates the process of downloading and launching the simulator, allowing developers to start simulating and testing locally with minimal effort.

Features

  • Easy Initialization: Quickly set up the GenLayer simulator with a single command.
  • Automated Downloads: Automatically downloads all necessary components required to run the simulator.
  • Developer-Friendly: Simplifies local development and testing workflows.
  • Extensible: Plans for additional commands to enhance interaction with the simulator.

How it's Built

The GenLayer CLI is a Command Line Interface tool built using Node.js and TypeScript. It's designed to automate the setup and management of the GenLayer simulator, simplifying the process for developers.

Technologies Used

  • Node.js: A JavaScript runtime environment that allows the execution of JavaScript code on the server side.
  • TypeScript: A statically typed superset of JavaScript that compiles to plain JavaScript, enhancing code reliability and maintainability.
  • ESBuild: A fast JavaScript bundler and minifier used for building the CLI efficiently.
  • Jest: A JavaScript testing framework utilized for writing and running tests.

Project Structure

The source code for the GenLayer CLI is organized as follows:

  • src/: Contains the main TypeScript source files.
  • tests/: Includes all the test files written using Jest.
  • dist/: The compiled JavaScript files ready for execution.

Requirements

Before using the GenLayer CLI, ensure your system meets the following requirements:

  • Node.js: Version 14.x or higher is required.
  • npm: Comes bundled with Node.js, used for managing packages.
  • Git: Required if cloning the repository directly from GitHub.
  • Operating System: Compatible with macOS, Linux, and Windows.

Installation

To install the GenLayer CLI globally using npm, ensure you have Node.js installed, then run:

  npm install -g genlayer

Usage

After installation, you can use the following command to start the simulator:

  genlayer init

This command will download the necessary components and start the simulator. Once initialized, you can execute further commands (to be implemented) to interact with the simulator.

General Format of Commands

The GenLayer CLI commands follow a consistent syntax pattern:

genlayer <command> [options]
  • <command>: The primary action you want the CLI to perform (e.g., init, up).
  • [options]: Optional flags that alter the behavior of the command.

Example

To initialize the GenLayer simulator with specific parameters:

genlayer init --numValidators 10 --branch develop

Contributing

Contributions to the GenLayer CLI are welcome! Feel free to fork the repository, make your changes, and submit a pull request. Your efforts to improve the software are greatly appreciated. To run the CLI from the repository:

  1. Clone the repository:
  git clone https://github.com/yeagerai/genlayer-cli.git
  1. Navigate to the project directory and install dependencies:
  cd genlayer-cli
  npm install
  1. Start the build process:
  npm run dev

This will continuously rebuild the CLI from the source. In another terminal window, execute CLI commands like:

  node dist/index.js init

Testing

The GenLayer CLI uses Jest with ts-jest for testing TypeScript files. To run tests:

  npm run test

Further Development

Additional commands are planned to enhance interaction with the GenLayer simulator. Stay tuned for updates.

Repository

You can find the GenLayer CLI repository on GitHub: GenLayer CLI Repository (opens in a new tab)

Full Reference

The full reference for the GenLayer CLI is available in the GenLayer CLI Reference.