Provides CLI commands based on natural language using GenAI. The tool is platform and CLI independent (works on Mac, Windows, and Linux).
- Go 1.20+
- An OpenAI API key
Non-secret configuration is read from a YAML config file. Secrets (API keys) are provided via environment variables.
- Config lookup order:
- If the environment variable AI_CLI_CONFIG is set, that path is used
- Otherwise, config.yaml in the current working directory is used
- If no file is found, built-in defaults are used
You can find a template with all supported options at config.example.yaml. Copy it to config.yaml and adjust as needed, or set AI_CLI_CONFIG to point to a specific file:
- Windows PowerShell:
$Env:AI_CLI_CONFIG = "C:\path\to\my-config.yaml" - bash/zsh:
export AI_CLI_CONFIG="/path/to/my-config.yaml"
Secrets:
- OPENAI_API_KEY must be provided via environment variable (not in the config file)
Build the CLI binary from the entrypoint package:
go build -o ai-cli-assistant ./cmd/ai-cli-assistantSet your OpenAI API key as environment variable OPENAI_API_KEY.
Windows (PowerShell):
$Env:OPENAI_API_KEY = "sk-..."
# optional: set CLI kind to tailor wording (e.g., powershell, bash, kubectl)
$Env:CLI_KIND = "powershell"
.\ai-cli-assistant "list all folders in this folder"macOS/Linux (bash/zsh):
export OPENAI_API_KEY="sk-..."
# optional:
export CLI_KIND="bash"
./ai-cli-assistant "list all folders in this folder"You can also run without building:
go run ./cmd/ai-cli-assistant "list all folders in this folder"Run all tests:
go test ./...