Wrap any CLI command as a Claude Code hook - with correct exit codes, stderr, and JSON
Project description
hokum
Every CLI command already knows how to fail.
hokumexplains it to Claude Code properly.
hokum is a command-line tool that you can use to wrap any other CLI command as a Claude Code hook,
dealing with the quirky semantics around exit codes, stderr, and JSON.
What Problem Does This Solve ?
Claude Code hooks look like ordinary shell commands, but Claude Code talks to them through a surprise-laden protocol all of its own — and ordinary CLI tools don't speak it:
- Input arrives as JSON on stdin. The hook event (which tool ran, which file it
touched, and so on) is delivered as a JSON document, not as command-line arguments.
A tool like
ruff checkoreslintwants a file path in argv and has no use for a JSON blob. - Exit codes carry unusual meanings.
0is success.2means "block with an error if relevant for this hook, and feed stderr back to Claude". Anything else — including the exit code1that nearly every linter, formatter, and test runner uses to report findings — is a non-blocking error: the output is shown to the user, but Claude never sees it. - Output routing depends on the outcome. Only stderr, and only with exit code
2, reaches Claude as feedback. Ordinary tools print their findings to stdout or stderr as they please, and exit1when something's wrong.
Put together, the naive setup — "run my linter after every edit" — produces a hook
that fires, finds problems, exits 1, and is silently ignored. Everything looks
configured, but nothing actually happens.
hokum sits between Claude Code and your command and translates in both directions:
it extracts what the command needs from the event JSON, runs the command as the
normal CLI tool it is, and maps the result onto the exit codes and streams that
Claude Code actually respects.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 hokum-0.3.0.tar.gz.
File metadata
- Download URL: hokum-0.3.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
400c8a0c882deece63cd81ba3f6ab6d9f27fe65a910e42336aa11d65ea72c8cc
|
|
| MD5 |
9c8e84ea7e76e685327baa860c7feda0
|
|
| BLAKE2b-256 |
9fcf4cb784907d9ce5bd4c12e26fa64a67995d8686c4d0dce468b39019ceb816
|
Provenance
The following attestation bundles were made for hokum-0.3.0.tar.gz:
Publisher:
manual-release.yml on garyd203/hokum
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hokum-0.3.0.tar.gz -
Subject digest:
400c8a0c882deece63cd81ba3f6ab6d9f27fe65a910e42336aa11d65ea72c8cc - Sigstore transparency entry: 2339225934
- Sigstore integration time:
-
Permalink:
garyd203/hokum@bb36d16f9aba27103b4973dbf05d8506beeac7d2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/garyd203
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
manual-release.yml@bb36d16f9aba27103b4973dbf05d8506beeac7d2 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file hokum-0.3.0-py3-none-any.whl.
File metadata
- Download URL: hokum-0.3.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0316e6a8a3225615465d095c96c8c588713408f6fc237f0340e0252ddf629985
|
|
| MD5 |
7dcf626cdb73ccd055c513440a2ac36a
|
|
| BLAKE2b-256 |
966b9b49fe6c43613d0e73a3ea3b635b755d7b1b33932a597e1a44757f6a9f8b
|
Provenance
The following attestation bundles were made for hokum-0.3.0-py3-none-any.whl:
Publisher:
manual-release.yml on garyd203/hokum
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hokum-0.3.0-py3-none-any.whl -
Subject digest:
0316e6a8a3225615465d095c96c8c588713408f6fc237f0340e0252ddf629985 - Sigstore transparency entry: 2339225944
- Sigstore integration time:
-
Permalink:
garyd203/hokum@bb36d16f9aba27103b4973dbf05d8506beeac7d2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/garyd203
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
manual-release.yml@bb36d16f9aba27103b4973dbf05d8506beeac7d2 -
Trigger Event:
workflow_run
-
Statement type: