Reference
Exit codes
Every chamoji command exits with one of four codes, so a script or CI job can
tell “nothing to release” from a failed check. The codes are the same with
--json.
The four codes
- Name
0- Description
- It worked, or there was nothing to change.
- Name
1- Description
Something went wrong: git failed, a file or line doesn’t exist, the config is invalid, or you cancelled.
- Name
2- Description
The command can’t go on as asked: it was used wrongly, a check failed, or it needs a terminal. The message says which. Every command that reads
chamoji.config.jsonalso exits 2 when itsreleasesection is from a newer chamoji.
- Name
3- Description
Nothing to release. Only
next-versionandreleaseuse it.
Error messages go to stderr, and most start with chamoji:. stdout keeps the command’s result, so $(chamoji next-version) and --json stay clean.
In a script
next-version prints nothing to stdout when it exits 3, so a release script stops instead of making a release called “none”:
version=$(chamoji next-version) && chamoji changelog --release "$version" -o CHANGELOG.md
To treat “nothing to release” as success in CI:
chamoji release --push || [ $? -eq 3 ]
Every command
- Name
chamoji- Description
- A bare
chamoji,--helpand--versionalways exit 0. An unknown command exits 2.
- A bare
- Name
changelog- Description
0 when it printed or wrote the changelog. 1 for anything else, such as an unknown
--format, or--unitin a repo without release units.
- Name
next-version- Description
0 when it printed a version. 3 when no commit since the last tag implies a bump. In a monorepo, 0 when any unit would release and 3 when none would, and 2 for a shallow clone it couldn’t unshallow or a version file it can’t set.
- Name
release- Description
0 when it released, or the dry run worked. 3 when there is nothing to release. 2 when a check failed: a dirty working tree, the wrong branch, a version that isn’t semver or isn’t newer, a first release with no version, a tag that already exists, or a shallow clone it couldn’t unshallow. In a monorepo, also a version file it can’t set, or a version that differs from its fixed group’s. 1 for anything else, such as a failed push.
- Name
setup- Description
0 when it saved, or nothing would change. 2 when something would change and there is no terminal and no
--yes, or--jsonand no--yes, when the hook step finds another tool’s hook, and for areleasesection from a newer chamoji. 1 when you cancel, for a step name it doesn’t know, or when a step fails.
- Name
commit- Description
0 when it committed. 2 when there is no terminal to ask on. 1 when you cancel, or git refuses the commit.
- Name
hook- Description
0 for
installanduninstall, including wheninstallonly prints the line forcore.hooksPathand when there was no hook to remove. 2 wheninstallfinds another tool’s hook and leaves it alone, and with no action or an unknown one. 1 outside a git repo, or when anything else fails. The hook itself,hook run, always exits 0, so it never blocks a commit.
- Name
ws- Description
0 when it worked. 2 when it was used wrongly, such as an unknown subcommand. 1 for anything else, such as a workstream that doesn’t exist.
- Name
why- Description
0 when it found the commit, and for a line you haven’t committed yet. 2 with no location, or more than one. 1 for anything else, such as a location that isn’t
file:line, a file or line that doesn’t exist, or a repo with no commits yet.
- Name
memory- Description
0 when it worked, including a search with no matches. 2 when it was used wrongly, such as an unknown subcommand, a missing slug or query, or an extra argument, and for
search --aiwith no TypeSafe key. 1 for anything else, such as an entry that doesn’t exist or is already archived, orsyncwith nooriginor a failed fetch or push.
- Name
card- Description
0 when it printed the URL or the numbers. 2 for a
releasesection from a newer chamoji. 1 for anything else, such as a repo it can’t tell, an--endpointthat isn’t an http(s) URL, or a--toref that doesn’t exist.
- Name
init- Description
0 when memory sharing is set up, when there is no
originto share with, and when the fetch from origin fails, which it reports on stderr. 1 when--agentscan’t safely change or write.mcp.jsonor.claude/settings.json, outside a git repo, or when anything else fails.
- Name
mcp- Description
0 when the agent closes the connection. 2 when it’s given arguments. 1 for anything else.
chamoji agent-hook, the hook Claude Code runs before a Bash command, always exits 0. Its answer is what it prints.
Examples
These are from real runs. Each one prints to stderr.
Exit codes
$ chamoji next-version
chamoji: no release needed (no commits since the last tag imply a version bump)