Skip to main content

Scaffold a clispec-compliant, agent-facing Rust CLI in seconds.

Project description

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.

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, 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, 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 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 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

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

clihatch-0.1.2.tar.gz (38.2 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.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (553.1 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

clihatch-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (514.0 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

clihatch-0.1.2-py3-none-macosx_11_0_arm64.whl (499.5 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

clihatch-0.1.2-py3-none-macosx_10_12_x86_64.whl (536.7 kB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: clihatch-0.1.2.tar.gz
  • Upload date:
  • Size: 38.2 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

Hashes for clihatch-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fe02268037349f1b480d7df3653bb3356efb84c8df1e2906645ba4082cfd6e81
MD5 e1e60dd8c56e273e3864c96dbc070280
BLAKE2b-256 a875d96c6e2e751678bb65d53bf4b68dd54ccada93df3994a543fa15136f4a7c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clihatch-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 553.1 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

Hashes for clihatch-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c20c977ea5678344ede145773b17cd505b378cb396475ab49f7552742c7db393
MD5 93754fa76253096a99c5be772d65c77b
BLAKE2b-256 be0b541f394a783a2c605387eaee03bc589c0423b78358545a8b35fd09adfb17

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clihatch-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 514.0 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

Hashes for clihatch-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fe1982cc87662a3eb9fa5105aa8f6871a481f434c3007f0756f8c7b41e9a6b4e
MD5 ea4672d24513aec222b0719be5faa4cf
BLAKE2b-256 49349b886bda934b641f271e1779a0eda0c0142fdb032351cbe2eec4fa8f137a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clihatch-0.1.2-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 499.5 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

Hashes for clihatch-0.1.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e16680e86643ddd05ed9869a6e38cec80de6c8c6e32bbfb68c85124a6f7c6f27
MD5 7b7bc7baeea8c5008c140e45221f94ab
BLAKE2b-256 49d71c60b64bee102242b0bee33e1dffad995dc3fca3d45aed55cc4d08199c31

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clihatch-0.1.2-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 536.7 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

Hashes for clihatch-0.1.2-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ef50390a79ec0fe4597561c23aa0335c14eeb6e17ac4c96913413139e9b9f1d4
MD5 8f3a52530c6ccccebc281482cb9a4638
BLAKE2b-256 038819d0c87d0637a88a10f7441597f2bf38f857abf83239059bc3622e84baaa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page