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.
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
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 dual-publish pipeline -
.github/workflows/{ci,release}.yml(GitHub-hosted, building macOS + Linux for crates.io + PyPI + Homebrew),pyproject.toml(maturin),Makefile,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.3.tar.gz.
File metadata
- Download URL: clihatch-0.1.3.tar.gz
- Upload date:
- Size: 38.6 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 |
8a3bda809687e092a98bdf4fb0578f6d77f67088d29ce0a7592060096607afb0
|
|
| MD5 |
9387327af16e970667e6eb9aa4ff10dc
|
|
| BLAKE2b-256 |
f4c62fa37ea343ea30bc8690f07b97920fa0c24f6ecb0f148118d75d6b90c60d
|
File details
Details for the file clihatch-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: clihatch-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 553.9 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 |
ef23a01c07b46370c224b95c4801c3bd6c5f6bf7c949fb2664c32f8f3bac9aaf
|
|
| MD5 |
088bef21c5dfafe67719e27b849545bf
|
|
| BLAKE2b-256 |
0c4f543f68cbc0b4181102c6e2cf61f93e605d768db2295615d9c3e6c1d3a547
|
File details
Details for the file clihatch-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: clihatch-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 514.6 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 |
c8ca2afd30ee5dc01b763197b817c7cba8aa6b9d2ac6773f8d10116dd1d4a7fd
|
|
| MD5 |
a62151d6d76ec0cd17715dbb1bef5d61
|
|
| BLAKE2b-256 |
d5744fd78aba4a68772a6a1c4f19d56515f1c673386ec592b993cf9d90be9298
|
File details
Details for the file clihatch-0.1.3-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: clihatch-0.1.3-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 500.1 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 |
9a68e4fae9bf10786e498635833cb46c53e4eb9a364c5c041987f20d7bae5da6
|
|
| MD5 |
21887edfbd5ab6af0c5d601ee39b69b2
|
|
| BLAKE2b-256 |
84ba37d21086439c21b0fb77ba49290c8b8767c5c673358f68dbc93aa81bb527
|
File details
Details for the file clihatch-0.1.3-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: clihatch-0.1.3-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 537.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 |
e4772208c7b011d03948bf4e5393d8de7caacad4ea3db50413930596c30ee37e
|
|
| MD5 |
9103f74185253325cdf6485f86fa73e9
|
|
| BLAKE2b-256 |
2d4a989e1d26aeed1a6ba1064643d1c296e2250d5b7a273529e4266c5375116a
|