Skip to main content

clihatch

CI crates.io clispec

Scaffold a complete, clispec-compliant, agent-facing Rust CLI in seconds - source skeleton, schema + conformance test, and the GitHub-hosted dual-publish release pipeline. No more copying your last tool and sed-ing the name.

Install

cargo install clihatch

Usage

clihatch new my-tool
cd my-tool && make check      # lint + tests pass out of the box
./target/debug/my-tool 21     # the example command runs

Options: --description, --owner (default rvben), --author (default: git config), --into <dir>, --no-git, --github, --no-pypi.

Use --no-pypi for a Rust-only tool: it omits the PyPI/maturin machinery, so the crate publishes to crates.io + Homebrew only (and never trips PyPI's new-project rate limit).

The whole path from nothing to a published release is four steps, and clihatch does three of them:

clihatch new my-tool --github   # scaffold + git commit + create & push the repo
cd my-tool && make check        # lint + tests, green out of the box
clihatch secrets my-tool        # bootstrap the three release secrets
vership release                 # tag + dual-publish

--github creates the public owner/name repo and pushes the initial commit (via gh), so clihatch secrets can run immediately. Without it, clihatch new prints the exact gh repo create command in its next-steps. Every new run lists the remaining steps through to a release.

Bootstrap release secrets

Once the repo exists on GitHub, wire up the three secrets the release pipeline needs in one step:

clihatch secrets my-tool            # -> rvben/my-tool
clihatch secrets my-tool --dry-run  # show what would be set, touch nothing
clihatch secrets my-tool --verify   # read-only: which secrets are already set
  • HOMEBREW_TAP_DEPLOY_KEY - generates an ed25519 key, registers it as a write deploy key on the tap (--tap, default rvben/homebrew-tap), and stores the private key. This is the fiddly part, fully automated.
  • CARGO_REGISTRY_TOKEN - read from $CARGO_REGISTRY_TOKEN or ~/.cargo/credentials.toml.
  • PYPI_API_TOKEN - read from $PYPI_API_TOKEN / $UV_PUBLISH_TOKEN, the [pypi] token in ~/.pypirc, or --pypi-token-stdin.

It preflights gh auth and repo access, so it fails fast (before generating a key) if you are not logged in. Re-running is idempotent: it rotates the deploy key (dropping the prior key with the same title) so the key and the stored secret stay in sync. Missing token sources are skipped with a hint, never invented.

What you get

A ready-to-cargo build, ready-to-release crate:

  • src/ - a minimal but complete clispec CLI: a default command, schema, completions, the structured-error envelope, exit-code contract, and TTY-aware -o auto|json|text. Replace the example run logic with yours.
  • schemas/clispec-v0.2.json + tests/conformance.rs - your schema output is validated against the spec by the test suite.
  • tests/cli.rs - end-to-end tests of the binary.
  • The release pipeline - .github/workflows/{ci,release}.yml (GitHub-hosted, building macOS + Linux). Each target publishes in its own job, so one target's failure (e.g. a registry rate limit) doesn't block the rest - re-run just the failed one with gh run rerun --failed. Includes pyproject.toml (maturin) for the PyPI wheel unless --no-pypi, plus Makefile, prek.toml, README.md, LICENSE, .gitignore.
  • A git init + initial commit (skip with --no-git). Generated sources are cargo fmt-clean.

clihatch is itself built with its own output's conventions - it eats its own dog food, and its test suite scaffolds a crate and compiles it to prove the templates stay valid.

Exit codes

code meaning
0 success
2 IO, git, or backend (gh/ssh-keygen) failure
3 usage error, or the target directory already exists

For agents (clispec)

clihatch schema

Structured output on stdout, structured error envelopes on stderr, a schema subcommand validated against clispec.dev/schema/v0.2.json. new and secrets are the mutating: true commands; new never overwrites, and secrets supports --dry-run.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clihatch-0.1.6.tar.gz (57.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

clihatch-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (578.3 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

clihatch-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (538.6 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

clihatch-0.1.6-py3-none-macosx_11_0_arm64.whl (525.2 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

clihatch-0.1.6-py3-none-macosx_10_12_x86_64.whl (561.2 kB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file clihatch-0.1.6.tar.gz.

File metadata

  • Download URL: clihatch-0.1.6.tar.gz
  • Upload date:
  • Size: 57.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for clihatch-0.1.6.tar.gz
Algorithm Hash digest
SHA256 a1f9af0fd6de072e1b6a3ea98af3db9e1fb8483a9ff27860cdd0c808e6fb8257
MD5 173d73e5c01b8308c628c4159637679e
BLAKE2b-256 944d184a1a625cebe574dfe9dd966b97cb3823c79b4f108b2dcc93cc4f826a8f

See more details on using hashes here.

File details

Details for the file clihatch-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: clihatch-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 578.3 kB
  • Tags: Python 3, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for clihatch-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 79eaabce71ca522f70d8581785fdc521824acfce3a09aef2e48940ef4e9acfeb
MD5 46bdee48c022180488a0d1a58679a21f
BLAKE2b-256 0b43e4a1a974a344bcc807a205550903a4055d3ee3047063f9dc9ef25a35aeaa

See more details on using hashes here.

File details

Details for the file clihatch-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: clihatch-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 538.6 kB
  • Tags: Python 3, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for clihatch-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a6e8ec3e020b06131e8518a8b40f979bf2ad1a4f9c59398e531f12d661a8e7a5
MD5 baa9fd942a1790c41f8390019a9b4abd
BLAKE2b-256 000bf12df6464295990adf59e45ab3c952988aff8704ce273c2ef61386a5c99e

See more details on using hashes here.

File details

Details for the file clihatch-0.1.6-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: clihatch-0.1.6-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 525.2 kB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for clihatch-0.1.6-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d70666e945b62b4849e973522ace9651e020e2004a6fd9449d84f53ec5890c88
MD5 3e8e171f61505171cd9ae6e9c78ed44f
BLAKE2b-256 fea38077264d94246de3cacf287a2bbdd18a0a8c6684fddcf71f8c0d130a3ee6

See more details on using hashes here.

File details

Details for the file clihatch-0.1.6-py3-none-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: clihatch-0.1.6-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 561.2 kB
  • Tags: Python 3, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for clihatch-0.1.6-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ca1395ec4fc4dab27f22989d7ce9e1131050cd81d3b059650088e78f3658a60f
MD5 71c4ce110e1604534bb0bf9aeb8cc563
BLAKE2b-256 50a8d713f84bafec9b992cf95ec08c187f0c9a645db5381bd18ef9a26b9c4271

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.6 This release

5 files

0.1.5

5 files

0.1.4

5 files

0.1.3

5 files

0.1.2

5 files

0.1.1

5 files

0.1.0

5 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page