earl

CLI Reference

Complete command reference for the earl CLI

Global Behavior

Earl reads configuration from ~/.config/earl/config.toml. Templates are loaded from ./templates/ (local, relative to cwd) and ~/.config/earl/templates/ (global). All commands that load templates merge both directories.

Environment Variables

VariableDescription
RUST_LOGControls log verbosity. Defaults to warn. Set to debug or trace for detailed diagnostics.
RUST_LOG=debug earl call github.search_issues --query "test"

Exit Codes

CodeMeaning
0Success.
1Error (invalid config, network failure, missing secret, template error, or earl doctor found one or more issues).

earl call

Execute a template command.

earl call <provider.command> [--key value ...] [--yes] [--json]

The first argument is the command key in provider.command form. Remaining arguments are passed as --key value pairs that bind to the template's declared parameters.

FlagDefaultDescription
--yesoffAuto-approve write-mode commands (skip the Type YES to continue: prompt).
--jsonoffPrint structured JSON output instead of the rendered text template.

Write-mode commands prompt for explicit confirmation unless --yes is passed.

Examples

# Read-mode call with parameters
earl call github.search_issues --query "repo:rust-lang/rust is:issue E-easy" --per_page 5

# Write-mode call, auto-approved
earl call github.create_issue --repo "myorg/myrepo" --title "Bug report" --yes

# JSON output for scripting
earl call stripe.list_charges --limit 10 --json | jq '.result'

earl templates

Work with templates. The --json flag is available globally on all subcommands.

earl templates list

List all loaded template commands.

earl templates list [--category <category>] [--mode read|write] [--json]
FlagDescription
--categoryFilter by category tag (e.g., --category monitoring).
--modeFilter by mode: read or write.
--jsonOutput as JSON array instead of table.
# List all templates
earl templates list

# Only write-mode templates, as JSON
earl templates list --mode write --json

Semantic search over template descriptions and metadata. Uses a local embedding model by default; optionally backed by a remote search endpoint if configured.

earl templates search '<query>' [--limit <n>] [--json]
FlagDefaultDescription
--limit10Maximum number of results to return.
--jsonoffOutput as JSON array instead of table.
earl templates search "list open pull requests" --limit 5

earl templates validate

Validate all template files in local and global template directories. Returns a list of validated files, or exits with an error on the first validation failure.

earl templates validate [--json]
# Human-readable output
earl templates validate

# JSON list of validated file paths
earl templates validate --json

earl templates import

Import a template from a local file path or a direct HTTP(S) URL to a .hcl file.

earl templates import <source> [--scope local|global] [--json]
FlagDefaultDescription
--scopelocalImport destination: local (./templates/) or global (~/.config/earl/templates/).
--jsonoffOutput import result as JSON.
# Import from local file
earl templates import ./my-provider.hcl

# Import from URL into global scope
earl templates import https://example.com/templates/slack.hcl --scope global

Only .hcl files are accepted. The source URL must point directly to the file (no git repos or archives). Maximum download size is 1 MiB.

earl templates generate

Generate a template by delegating to a coding CLI. Earl builds a structured prompt from your description and pipes it into the specified CLI's stdin.

earl templates generate -- <cli> [args...]

Everything after -- is the coding CLI invocation. Earl will interactively ask you to describe the template you want before sending the prompt.

# Delegate to Claude Code
earl templates generate -- claude --dangerously-skip-permissions

# Delegate to any coding CLI
earl templates generate -- my-coding-cli --flag

earl templates generate does not support the --json flag.


earl secrets

Manage secrets in the OS keychain (macOS Keychain, Windows Credential Manager, or Linux Secret Service).

earl secrets set

Store a secret value. Prompts interactively for the value by default.

earl secrets set <key> [--stdin]
FlagDescription
--stdinRead the secret value from stdin instead of an interactive prompt.
# Interactive prompt (value is hidden)
earl secrets set github.token

# Pipe from an environment variable
printf '%s' "$GITHUB_TOKEN" | earl secrets set github.token --stdin

earl secrets get

Show metadata for a stored secret.

earl secrets get <key>

This command displays metadata only (key name, created/updated timestamps). The plaintext secret value is never printed.

earl secrets list

List all stored secret keys with their timestamps.

earl secrets list

earl secrets delete

Delete a secret from the keychain.

earl secrets delete <key>

earl auth

Manage OAuth2 authentication profiles. Each <profile> argument must match a [auth.profiles.<profile>] section in config.toml.

Supported OAuth flows: auth_code_pkce, device_code, client_credentials.

earl auth login

Start the OAuth login flow for a profile.

earl auth login <profile>
earl auth login github

earl auth status

Show current token status for a profile (logged in, expiration, scopes).

earl auth status <profile>

earl auth refresh

Force an immediate token refresh for a profile.

earl auth refresh <profile>

earl auth logout

Delete the stored token for a profile.

earl auth logout <profile>

earl mcp

Run an MCP (Model Context Protocol) server for AI agent integration. Each template command is exposed as an MCP tool.

earl mcp [stdio|http] [--listen <addr>] [--mode full|discovery] [--yes]
FlagDefaultDescription
stdio / httpstdioTransport protocol. stdio communicates over stdin/stdout; http starts an HTTP server.
--listen <addr>127.0.0.1:8977Bind address for the HTTP transport. Ignored when using stdio.
--mode <mode>fullfull exposes one MCP tool per template command. discovery exposes search and call wrapper tools.
--yesoffAuto-approve write-mode tool calls. Without this flag, write-mode tools are rejected at runtime.

Examples

# Default: stdio transport, full mode
earl mcp

# stdio with write-mode tools enabled

earl mcp stdio --yes
# HTTP transport on default port
earl mcp http

# HTTP on custom address with discovery mode
earl mcp http --listen 0.0.0.0:9000 --mode discovery --yes

Write-mode tools are blocked by default. If an AI agent calls a write-mode tool without --yes, the server returns an error: tool 'X' is write-mode; restart the MCP server with --yes to enable write tools.


earl doctor

Diagnose configuration and setup issues. Runs a series of checks and prints a summary report.

earl doctor [--json]
FlagDescription
--jsonOutput the full report as structured JSON (checks array + summary counts).

Checks Performed

Check IDWhat it verifies
config_fileConfig file exists at ~/.config/earl/config.toml and parses without errors.
network_allowlistReports configured [[network.allow]] rule count.
templatesTemplate files are discovered in local and global directories.
template_validationAll discovered templates pass schema validation.
commandsAt least one command is loadable from templates.
required_secretsAll secrets referenced by templates are present in the keychain.
oauth_profilesAll OAuth profiles referenced by templates are defined and valid in config.
remote_searchRemote semantic search configuration is complete (if enabled).
bashBash sandbox tool is available (only when compiled with the bash feature).
# Human-readable report
earl doctor

# Machine-readable JSON
earl doctor --json

The command exits with code 1 if any check has error status.


earl web

Launch a local web server with documentation and a playground for loaded template tools.

earl web [--listen <addr>] [--no-open]
FlagDefaultDescription
--listen <addr>127.0.0.1:0Bind address. Port 0 selects a random available port.
--no-openoffDo not automatically open the browser.

The server prints its URL and a bearer token on startup. Press Ctrl+C to stop.

# Default: random port, opens browser
earl web

# Fixed port, no browser
earl web --listen 127.0.0.1:3000 --no-open

earl completion

Generate shell completion scripts.

earl completion <shell>

Supported shells: bash, zsh, fish, powershell, elvish.

earl completion bash > ~/.local/share/bash-completion/completions/earl
earl completion zsh > ~/.zfunc/_earl
# Ensure ~/.zfunc is in your fpath
earl completion fish > ~/.config/fish/completions/earl.fish
earl completion powershell >> $PROFILE

On this page