Open Source CLI Template

Ship Rust CLIs
Without the Boilerplate

A batteries-included template with structured errors, config management, agent backend, CI/CD pipelines, and automated releases — so you can focus on your logic, not your scaffolding.

Get Started View on GitHub

Everything You Need

🔋

Batteries Included

Clap argument parsing, tokio async runtime, and tracing observability wired up from day one.

🛡️

Snafu Errors

Structured, contextual error handling with snafu — no manual Display or Error impls.

npx Install

Run instantly via npx — no Rust toolchain required. Pre-built binaries for macOS and Linux.

🚀

CI/CD Ready

GitHub Actions with lint, test, and release pipelines preconfigured and working out of the box.

🤖

Agent-Friendly

JSON stdout, actionable errors, example-driven help — designed for AI agents to operate reliably.

📦

Release Automation

Conventional commits, changelogs, and version bumps handled automatically by release-plz.

Built for AI Agents

AI agents operate your CLI programmatically. This template bakes in the rararulab agent-friendly CLI standards so every generated project is agent-ready from day one.

01

JSON stdout, logs stderr

Structured output on stdout for machine parsing. Human-readable logs on stderr. Never mix formats.

02

Fail fast with suggestions

Every error includes a suggestion field so agents can self-correct without human intervention.

03

Non-interactive first

Every parameter passable via flags. No stdin prompts without a flag equivalent. Agents cannot handle dynamic prompts.

04

Example-driven help

Every subcommand's --help includes runnable examples. Agents pattern-match better than they parse prose.

05

Idempotent operations

Agents retry frequently. Create operations return success if the resource already exists — no duplicate side effects.

06

Dry-run & force bypass

Destructive commands support --dry-run. Interactive confirmations have --yes to bypass. Safe automation by default.

# Success: structured JSON on stdout
$ my-cli deploy --env staging
{"ok": true, "action": "deploy", "deploy_id": "d-123"}

# Error: actionable suggestion included
$ my-cli deploy
{"ok": false, "error": "missing --env", "suggestion": "add --env staging or --env prod"}

Get Started

Use Instantly

$ npx @your-org/your-project --help

Create Your Own

$ cargo generate rararulab/cli-template
$ cd my-awesome-cli
$ cargo run -- --help
  1. Install instantly via npx — no Rust required
  2. Or generate your own project with cargo generate
  3. Agent-friendly by default — JSON output, actionable errors