Skip to main content

Crate commit_wizard

Crate commit_wizard 

Source
Expand description

§Commit Wizard Icon Commit Wizard (cw)

Crates.io docs.rs CI License

A spellbook for your commits.

A command-line assistant for Conventional Commits, semantic versioning, and changelog automation.

cw guides you through writing structured commits, checks history against your project’s rules, works out the next version, tags releases, writes changelogs, and repairs messages that broke the rules. It walks newcomers through each step and gets out of the way for people who already know what they want: everything it asks can also be given as a flag.

Commit Wizard Mascot

Full user manual: https://commit-wizard.kitechsoftware.com

§Install

cargo install commit-wizard --locked
cw --version

This installs the cw binary. It needs a recent stable Rust toolchain (1.89 or newer) and git on your PATH.

§Quick start

cd my-repo
cw init            # a short guided setup that writes .cwizard.toml
cw add             # pick the files to stage
cw commit          # type, scope, subject, breaking change... then commit
cw check           # validate history against the rules
cw tag             # work out the next version from your commits and tag it
cw changelog       # write CHANGELOG.md from the history

§Commands

CommandWhat it does
cw commitWrite a Conventional Commit through guided prompts, or from flags
cw addStage and unstage files with a picker, paths, or --all
cw checkValidate commits against the rules; exits non-zero when any break them
cw fixRewrite commit messages that break the rules, safely, with a backup
cw branchList, switch, create and prune branches, including ones whose remote is gone
cw bumpCalculate the next semantic version from the commits since the last tag
cw tagCreate (and optionally sign and push) the next version tag, release candidates included
cw changelogGenerate or update a changelog from the tag history, in Markdown or JSON
cw pushPush with your branch and commit policies applied
cw initCreate a project or user config through a guided wizard
cw configShow, edit, list and explain configuration, including where each value comes from
cw doctorDiagnose configuration and environment problems

§Guided for newcomers, scriptable for everyone else

On a terminal, cw asks for whatever it is missing. Give it the flags and it asks nothing:

cw commit                                 # walks you through it
cw commit -t feat -s api -m "add parser"  # no questions

Scripts and CI never get prompts: with no terminal, or with --non-interactive, --ci or --json, cw runs on flags alone and stops with a clear message naming the flag it needs. --yes accepts the default answer to any question that has one. --dry-run previews anything that would change something.

In a pipeline:

cw check                  # fails the job if any commit breaks the rules
cw bump --json            # machine-readable next version
cw tag --push             # tag and push the release

§Configuration

Settings live in .cwizard.toml (or cwizard.toml) in your project, and in ~/.config/cwizard/config.toml for you. Files can be TOML, YAML or JSON.

  • Layers are merged setting by setting: command-line flags, then CW_* environment variables, then the project file, then a shared registry, then built-in defaults. cw config list --effective shows the result and which layer each value came from.
  • A registry is a Git repository of shared conventions (such as the Angular or gitmoji styles) that a team or organisation can point every project at, then override locally.
  • Config edits keep your comments (TOML) and are written atomically, so an interrupted write never leaves a broken file.

See the manual for the full schema.

§Status

cw is pre-1.0: the command line and configuration are what you should rely on, and they may still change between 0.x releases. The Rust library behind it is an implementation detail and is not a stable API.

§Contributing

Contributions are welcome; please read CONTRIBUTING.md first.

§License

Licensed under either of

at your option.


§This is a tool, not a library

The code is published as a library crate only so that the cw binary, its tests and docs.rs can share it. Everything except cli::run is hidden from these docs and carries no stability guarantee: it may change in any release, patch releases included. If you want to build on cw, depend on its command line and its configuration files, not on this API.

§Contributing to the code

The crate is layered from the outside in: cli (argument parsing and dispatch), core (the use case behind each command), engine (models, configuration and rules, with no I/O) and infra (Git, terminal and file-system adapters). ARCHITECTURE.md walks through how a command flows through them and how to add one, and cargo doc --document-private-items --open shows the hidden modules.

§What cw enforces

Commits follow the Conventional Commits layout:

<type>(<scope>): <description>

<body>

<footer>

The allowed types and scopes come from your configuration (the standard profile ships feat, fix, docs, style, refactor, perf, test and chore; a shared registry or your own config can add more). Version bumps follow Semantic Versioning:

  • major: a breaking change (feat!: or a BREAKING CHANGE: footer)
  • minor: a new feature (feat)
  • patch: a fix (fix) and other patch-level types

Modules§

cli
Command-line interface for Commit Wizard.