Scaffold a clispec-compliant, agent-facing Rust CLI in seconds.
Project description
clihatch
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, defaultrvben/homebrew-tap), and stores the private key. This is the fiddly part, fully automated.CARGO_REGISTRY_TOKEN- read from$CARGO_REGISTRY_TOKENor~/.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 examplerunlogic with yours.schemas/clispec-v0.2.json+tests/conformance.rs- yourschemaoutput 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 withgh run rerun --failed. Includespyproject.toml(maturin) for the PyPI wheel unless--no-pypi, plusMakefile,prek.toml,README.md,LICENSE,.gitignore. - A
git init+ initial commit (skip with--no-git). Generated sources arecargo 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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clihatch-0.1.5.tar.gz.
File metadata
- Download URL: clihatch-0.1.5.tar.gz
- Upload date:
- Size: 44.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f789a9524b5c546affc75a13bb5a2193d8991cf7bbd0ba60d37534c01f73edc2
|
|
| MD5 |
a92b6d25993ee70f1a2df279f755b835
|
|
| BLAKE2b-256 |
acab3039c909622148b36bec627ec7b2dac955f4e35497d72f3ac67142c03aa9
|
File details
Details for the file clihatch-0.1.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: clihatch-0.1.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 567.7 kB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3a4b283ac92f5391076b7bb5950f69dcf452a6317cf4c855bb7965b1da7bd19
|
|
| MD5 |
812bf1d5007340824f9d68f8cba92dc2
|
|
| BLAKE2b-256 |
07adfb56625026255480e61d08e552ee9bdae56e41e2980ecd1b873e119256fa
|
File details
Details for the file clihatch-0.1.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: clihatch-0.1.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 526.1 kB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3922ca58d1d06ba8d37bf0044a9d36b41dbf2bdcc9b72f5ca5fc3093af0b4fb6
|
|
| MD5 |
18ba4c4e74508525bb2f817ecad97d53
|
|
| BLAKE2b-256 |
2c64a87ebb09eefe3fc122e4d667b7fc97527bfd9d3f63738c6cd3bcce3a8541
|
File details
Details for the file clihatch-0.1.5-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: clihatch-0.1.5-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 512.2 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f55632d6c0fe40b407039bea589149c94514a035092b21202831b1135b92e863
|
|
| MD5 |
c58458ee9912bfc72f18df096c0b5f55
|
|
| BLAKE2b-256 |
377c0b817c64375137be996cfd82b5f32c64d48873aaf52339aa1b993abfb4bb
|
File details
Details for the file clihatch-0.1.5-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: clihatch-0.1.5-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 549.3 kB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b893c758fa41d65fa0945cc693da1e6198d2090a44dc5b143683c3a9cc4b7ce1
|
|
| MD5 |
e4282bc720c3837732fa68a6282a08ed
|
|
| BLAKE2b-256 |
d157fbb0347a2124fb9dec5bd212ef06650573d15a9f08521228c2202985dbba
|