Skip to content

OpacityLabs/cli

Repository files navigation

Opacity CLI

A command-line tool for bundling and analyzing Luau files using luau-lsp. This tool provides a convenient way to manage Luau modules across different platforms and flows, with powerful static analysis capabilities.

Features

  • Bundling: Bundle Luau files with configurable output formats
  • Rebundle Mode: Serve bundled flows over HTTP with optional file rebundling
  • Static Analysis: Analyze Luau files using luau-lsp for type checking, linting, and code quality
  • Generate Completions: Generate completions for the CLI
  • Platform Organization: Organize your Luau modules by platform and flows
  • Configurable: Easy-to-use TOML configuration

Installation

First, install luau-lsp (and make sure you have it in the PATH):

https://github.com/JohnnyMorganz/luau-lsp/releases

Then, install the Opacity CLI:

# Install Opacity CLI
cargo install --git https://github.com/OpacityLabs/cli

Usage

# Bundle your Luau files
opacity-cli bundle --config config.toml

# Analyze your Luau files with luau-lsp
opacity-cli analyze --config config.toml

# Serve your Luau files, (--rebundle) will auto bundle new changes.
opacity-cli serve --rebundle

Analysis Features

The analyze command uses luau-lsp to provide:

  • Type checking
  • Linting
  • Code quality analysis
  • Error detection
  • Best practices validation

Generating Completions

To generate completions for the CLI, run the following command:

opacity-cli completions <shell> > <output-file>

Where <shell> is one of bash, zsh, fish, or powershell and <output-file> is the file to save the completions to.

Example:

opacity-cli completions zsh > ~/.oh-my-zsh/completions/_opacity-cli

Mapper testing

To also have the serve command serve mappers, you need to create a mappers.location file in the root of the project with the following content:

<mappers-folder>

Where <mappers-folder> is the folder containing the mappers, the path has to be ABSOLUTE.

To get it, just navigate to the mappers folder and run pwd.

Every time you change a mapper, or the first time you want to serve the mappers, make sure you run the cargo xtask aggregate && opacity-cli bundle in the mappers folder.

If you wish to add/remove mappers, you have to shut down the cli http server, modify the opacity.toml file, and then run it again. Changes to the opacity.toml are not updated automatically, a server restart is required!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages