Omni CLI
website·Indexed 31 days ago
https://omnicli.devA tool for managing development environments, dependencies, and custom commands. Omni supports automated tool installation via mise, nix, and various package managers (apt, dnf), handles repository-specific configurations, and allows the definition of custom commands through Makefiles or executable paths with integrated argument parsing and autocompletion.
What's inside Omni
- Omnipotent (omni) is a tool designed to wrap sets of commands and provide a consistent interface for interacting with them. It allows developers to make commands available within a git repository and execute them from anywhere in the system by adding omni to the system path, regardless of the current working directory. Key features include dynamic environment loading and discoverability of up-to-date commands.
Overview of Omni command-line tool
Omni is a tool designed to standardize and simplify the developer experience by wrapping sets of commands and providing a consistent interface to interact with them. It addresses common pain points such as incompatible dependencies, disparate toolsets, and poor command discoverability in growing organizations. Key capabilities include:
- Simplifying dependency definitions and enabling single-command repository setups.
- Automating global command updates.
- Providing a centralized entry point via a single repository to streamline onboarding.
- Dynamically loading environments to reduce manual setup time when switching between repositories.
Use Tera templating in Omni configuration
Omni supports templating for specific elements of its configuration using the Tera templating format, which is very similar to Jinja2 syntax.Omni CLI built-in command precedence and behavior
Omni provides a set of built-in commands that are available whereveromnican be called and execute from the current working directory. Built-in commands take precedence over custom commands, makefile commands, and configuration commands; they cannot be overridden. However, users can still define 'subcommands' that will be executed when the specific built-in command is called.Validate configuration and command metadata using `omni config check`
Theomni config checkcommand validates configuration files and commands within the omnipath for errors. It is used for debugging, ensuring configuration correctness, and linting omni command metadata.Understand the execution environment for OMNI custom commands
Configuration commands in OMNI are executed from the directory where the configuration file defining them is located. This ensures that relative paths used within the command remain valid regardless of where the user invokes the CLI.
Commands are scoped based on where they are defined:
- Repository-scoped: Defined in the repository's omni configuration.
- Global: Defined in a global configuration file and available everywhere.
- To access a repository-scoped command from elsewhere, use the
omni scopecommand.
Manage Homebrew installations with Omni
Use thehomebrew(orbrew) step to tap Homebrew repositories and install formulae or casks. Omni tracks the repositories and packages it installs; when runningomni down, any dependencies installed by Omni that are no longer required by activeomni uprepositories are automatically uninstalled. Ifbrewis not available on the system, this step is ignored.Understand and use omni shims for IDE integration
Omni provides shims (fake binaries) to manage tool versions for IDEs that do not load the full shell environment before running tools. Shims resolve to the expected version of a tool based on the current working directory. By default, omni loads shims but removes them from the path in interactive shells to favor direct path entries. The shims are typically located in~/.local/share/omni/shims, but this followsOMNI_DATA_HOMEorXDG_DATA_HOMEif set.Install tools from GitHub releases using omni
Omni can install tools from GitHub releases by downloading assets that match the current operating system and architecture. For a release to be compatible, assets must meet the following criteria:
- Be provided as a
.tar.gzarchive, a.ziparchive, or a binary file (no extension). - The filename must contain hints about the target OS (e.g.,
linux,darwin). - The filename must contain hints about the target architecture (e.g.,
amd64,arm64).
Omni downloads matching assets, verifies checksums, extracts them, and moves binary files to the repository environment. On ARM Macs (M1, M2, etc.) with Rosetta installed, Omni will fallback to downloading
amd64assets ifarm64versions are unavailable.- Be provided as a
Custom operation parameters reference
The following parameters are available for
customoperation steps:name(string): The display name of the step shown duringomni uporomni down.meet(multiline string): The command executed to satisfy the requirement during setup.met?(multiline string): The command executed to determine if the requirement is currently met (preventsmeetfrom running if this returns success).unmeet(multiline string): The command executed to reverse the requirement during teardown.dir(path): The relative path to the directory where the operation should run. The dynamic environment of this directory is loaded before execution. Defaults to the work directory root.
Manage Python dependencies with the pip parameter
The
pipparameter controls how dependencies are installed usinguv.trueorauto(default): Omni automatically installs dependencies from recognized requirement files in the specified directories.false: Disables dependency installation.path(string or list): Specifies relative paths to specific requirements files to be used withpip install -r.
When
pip: autois used, Omni detects files in this priority order:poetry.lock,Pipfile.lock,pyproject.toml,requirements.txt, andPipfile.up: - python: version: 3.11.4 pip: auto # Auto-detects requirements files # OR pip: req.txt # Installs specific fileIntegrate omni with JetBrains IDEs
JetBrains IDEs (IntelliJ, PyCharm, WebStorm, GoLand, RubyMine, RustRover) supportasdfintegration. Since omni uses a compatible backend, you can symlink omni'smisedirectory to the.asdfdirectory in your home folder. After symlinking, select the desiredasdfSDK version inProject Settings>Project>SDK(or underLanguages & Frameworksfor specific tools like Node.js).ln -s ~/.local/share/omni/mise ~/.asdf