Skip to main content

Configuration

Hexagon CLIs are configured using YAML files. This guide explains the structure and options available in the configuration file.

Configuration File Structure

A Hexagon configuration file has three main sections:

  • cli: Defines the CLI itself
  • envs: Defines the environments your CLI supports
  • tools: Defines the tools available in your CLI

Here's a basic example:

cli:
name: My CLI
command: mycli
custom_tools_dir: ./custom_tools
plugins: []

envs:
- name: development
alias: dev
- name: production
alias: prod

tools:
- name: tool1
alias: t1
type: web
action: open_link
envs:
development: https://dev.example.com
production: https://example.com

CLI Configuration

The cli section defines the basic properties of your CLI:

PropertyDescriptionRequired
nameThe display name of your CLIYes
commandThe command used to invoke your CLIYes
custom_tools_dirDirectory for custom tool implementationsNo
pluginsList of plugins to useNo
entrypoint.shellCustom shell to use for commandsNo
entrypoint.pre_commandCommand to run before each tool executionNo
entrypoint.environEnvironment variables to setNo

Environment Configuration

The envs section defines the environments your CLI supports:

PropertyDescriptionRequired
nameThe name of the environmentYes
aliasShort alias for the environmentNo
long_nameLonger descriptive nameNo
descriptionDetailed descriptionNo

Tool Configuration

The tools section defines the tools available in your CLI:

PropertyDescriptionRequired
nameThe name of the toolYes
aliasShort alias for the toolNo
long_nameLonger descriptive nameNo
descriptionDetailed descriptionNo
typeTool type (web, shell, function, etc.)Yes
actionThe action to performYes
envsEnvironment-specific configurationsNo
iconIcon to displayNo
tracedWhether to trace tool executionNo

Tool Types

Hexagon supports several tool types:

  • web: Opens a web link
  • shell: Executes a shell command
  • function: Calls a Python function
  • group: Groups multiple tools together
  • misc: Miscellaneous tool type
  • hexagon: Hexagon-specific tools
  • separator: Visual separator in the CLI

Configuration File Location

Hexagon looks for configuration files in several locations:

  1. The path specified by the HEXAGON_CONFIG_FILE environment variable
  2. A file named hexagon_tools.yaml in the current directory
  3. A file named hexagon_tools.yml in the current directory

Next Steps

Now that you understand how to configure your CLI, check out the Creating a CLI guide for a more detailed walkthrough.