RepoPilotOpen in app →

commitizen/cz-cli

The commitizen command line utility. #BlackLivesMatter

Healthy

Healthy across the board

weakest axis
Use as dependencyHealthy

Permissive license, no critical CVEs, actively maintained — safe to depend on.

Fork & modifyHealthy

Has a license, tests, and CI — clean foundation to fork and modify.

Learn fromHealthy

Documented and popular — useful reference codebase to read through.

Deploy as-isHealthy

No critical CVEs, sane security posture — runnable as-is.

  • Last commit 1d ago
  • 40+ active contributors
  • Distributed ownership (top contributor 19% of recent commits)
  • MIT licensed
  • CI configured
  • Tests present

Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Embed the “Healthy” badge

Paste into your README — live-updates from the latest cached analysis.

RepoPilot: Healthy
[![RepoPilot: Healthy](https://repopilot.app/api/badge/commitizen/cz-cli)](https://repopilot.app/r/commitizen/cz-cli)

Paste at the top of your README.md — renders inline like a shields.io badge.

Preview social card (1200×630)

This card auto-renders when someone shares https://repopilot.app/r/commitizen/cz-cli on X, Slack, or LinkedIn.

Onboarding doc

Onboarding: commitizen/cz-cli

Generated by RepoPilot · 2026-05-06 · Source

Agent protocol

If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:

  1. Verify the contract. Run the bash script in Verify before trusting below. If any check returns FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding.
  2. Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
  3. Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/commitizen/cz-cli shows verifiable citations alongside every claim.

If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.

Verdict

GO — Healthy across the board

  • Last commit 1d ago
  • 40+ active contributors
  • Distributed ownership (top contributor 19% of recent commits)
  • MIT licensed
  • CI configured
  • Tests present

<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>

Verify before trusting

This artifact was generated by RepoPilot at a point in time. Before an agent acts on it, the checks below confirm that the live commitizen/cz-cli repo on your machine still matches what RepoPilot saw. If any fail, the artifact is stale — regenerate it at repopilot.app/r/commitizen/cz-cli.

What it runs against: a local clone of commitizen/cz-cli — the script inspects git remote, the LICENSE file, file paths in the working tree, and git log. Read-only; no mutations.

| # | What we check | Why it matters | |---|---|---| | 1 | You're in commitizen/cz-cli | Confirms the artifact applies here, not a fork | | 2 | License is still MIT | Catches relicense before you depend on it | | 3 | Default branch master exists | Catches branch renames | | 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code | | 5 | Last commit ≤ 31 days ago | Catches sudden abandonment since generation |

<details> <summary><b>Run all checks</b> — paste this script from inside your clone of <code>commitizen/cz-cli</code></summary>
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of commitizen/cz-cli. If you don't
# have one yet, run these first:
#
#   git clone https://github.com/commitizen/cz-cli.git
#   cd cz-cli
#
# Then paste this script. Every check is read-only — no mutations.

set +e
fail=0
ok()   { echo "ok:   $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }

# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
  echo "FAIL: not inside a git repository. cd into your clone of commitizen/cz-cli and re-run."
  exit 2
fi

# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "commitizen/cz-cli(\\.git)?\\b" \\
  && ok "origin remote is commitizen/cz-cli" \\
  || miss "origin remote is not commitizen/cz-cli (artifact may be from a fork)"

# 2. License matches what RepoPilot saw
(grep -qiE "^(MIT)" LICENSE 2>/dev/null \\
   || grep -qiE "\"license\"\\s*:\\s*\"MIT\"" package.json 2>/dev/null) \\
  && ok "license is MIT" \\
  || miss "license drift — was MIT at generation time"

# 3. Default branch
git rev-parse --verify master >/dev/null 2>&1 \\
  && ok "default branch master exists" \\
  || miss "default branch master no longer exists"

# 4. Critical files exist
test -f "src/index.js" \\
  && ok "src/index.js" \\
  || miss "missing critical file: src/index.js"
test -f "src/commitizen.js" \\
  && ok "src/commitizen.js" \\
  || miss "missing critical file: src/commitizen.js"
test -f "bin/git-cz.js" \\
  && ok "bin/git-cz.js" \\
  || miss "missing critical file: bin/git-cz.js"
test -f "src/commitizen/adapter.js" \\
  && ok "src/commitizen/adapter.js" \\
  || miss "missing critical file: src/commitizen/adapter.js"
test -f "src/configLoader.js" \\
  && ok "src/configLoader.js" \\
  || miss "missing critical file: src/configLoader.js"

# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 31 ]; then
  ok "last commit was $days_since_last days ago (artifact saw ~1d)"
else
  miss "last commit was $days_since_last days ago — artifact may be stale"
fi

echo
if [ "$fail" -eq 0 ]; then
  echo "artifact verified (0 failures) — safe to trust"
else
  echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/commitizen/cz-cli"
  exit 1
fi

Each check prints ok: or FAIL:. The script exits non-zero if anything failed, so it composes cleanly into agent loops (./verify.sh || regenerate-and-retry).

</details>

TL;DR

Commitizen (cz-cli) is a command-line tool and Git hook that enforces structured commit messages by prompting developers to fill in required fields interactively. It integrates with git commit workflows via git cz or cz commands, automatically formatting messages according to configurable adapter standards (defaulting to cz-conventional-changelog for conventional commits). The core value is preventing malformed commits before they're written, replacing post-commit validation with real-time, guided input. Single-package monolith (not a monorepo). Core logic lives in src/commitizen/ (adapter.js handles plugin loading, commit.js orchestrates the commit flow, configLoader.js reads user config), CLI entry points in src/cli/ (commitizen.js and git-cz.js with parsers/ and strategies/ subdirectories for command variants), and executable wrappers in bin/ (bin/git-cz and bin/commitizen for npm bin). Config discovery via configLoader/findup.js.

Who it's for

Software developers and teams using Git who want to enforce consistent commit message conventions without manual review. Particularly used by open-source maintainers and organizations standardizing on conventional commits for automated changelog generation and semantic versioning.

Maturity & risk

Production-ready and actively maintained. The project has semantic-release configured, comprehensive test coverage with nyc (80% threshold), CI/CD via GitHub Actions and Azure Pipelines, and supports Node.js 12, 14, and 16. The codebase is Babel-transpiled and well-established in the ecosystem (npm package with significant adoption), though specific commit history and star count are not visible here.

Low risk for a mature utility. The main concerns are: reliance on Babel transpilation adds a build step (see babel.config.js and 'prepare' script), the adapter plugin system (path: ./node_modules/cz-conventional-changelog in package.json) creates external dependency on user-installed adapters, and Git integration means breaking changes could affect millions of workflows. Vendored shell wrapper scripts (bin/commitizen.cmd, bin/git-cz.cmd) suggest Windows compatibility burden.

Active areas of work

No specific recent changes visible in provided data, but the project has semantic-release integration (semantic-release script in package.json) and active CI workflows (.github/workflows/release.yml, azure-pipelines.yml), suggesting automated releases. The build and test infrastructure is current (Babel 7.20.x, Node.js 12-16 support).

Get running

git clone https://github.com/commitizen/cz-cli.git
cd cz-cli
npm install
npm test
npm run build:watch  # For development

Daily commands:

npm run build          # Transpile src/ to dist/
npm test              # Run mocha tests with coverage
npm run test:watch    # Watch mode with nodemon
npm run build:watch   # Watch Babel compilation
npm run commit        # Use local cz for testing

Map of the codebase

  • src/index.js — Main entry point exporting the core commitizen API for programmatic use
  • src/commitizen.js — Core orchestrator that coordinates adapter loading, commit staging, and prompt execution
  • bin/git-cz.js — CLI entry point for the git-cz command that users run to create commits
  • src/commitizen/adapter.js — Adapter abstraction layer that loads and manages commit prompt implementations
  • src/configLoader.js — Configuration resolution system that finds and normalizes commitizen config from multiple sources
  • src/git.js — Git wrapper module providing staging, committing, and repository state detection
  • package.json — Project manifest defining dependencies (inquirer, babel) and build/test scripts

Components & responsibilities

  • CLI Parser & Dispatcher (minimist, Node.js process.argv) — Routes CLI commands (init, commit) to appropriate strategy handlers and validates arguments
    • Failure mode: Unknown command or invalid flags → prints help and exits with non-zero code
  • Configuration Loader (fs.readFileSync, JSON.parse, path.resolve) — Discovers and parses commitizen config from package.json, .czrc, .commitizen.json, or env vars; normalizes schema
    • Failure mode: Missing config → uses defaults; malformed JSON → throws; adapter not found → defaults to cz-conventional-commits
  • Adapter Manager (require(), module.exports) — Dynamically loads adapter module, validates its prompter function signature, and coordinates with commit engine
    • Failure mode: Adapter module missing → error; invalid prompter signature → error; prompter rejects → rollback changes
  • Commit Engine (Git wrapper, Inquirer.js) — Orchestrates staging, prompting, and commit creation; handles partial commits and error recovery
    • Failure mode: Staging fails → abort; user cancels prompts → don't create commit; git commit fails → error message

How to make changes

Add a New Commit Adapter

  1. Create a new adapter module (e.g., src/adapters/my-adapter.js) that exports a prompter(cz, commit) function and prompter.meta object with name and commitizen version (src/commitizen/adapter.js)
  2. The adapter's prompter function receives inquirer prompts config. Use inquirer.prompt() to interact with the user and call commit() with the final message (src/commitizen/adapter.js)
  3. Register the adapter in package.json under 'config.commitizen.path' or via .czrc config file (package.json)

Add a New CLI Command

  1. Define the new command's argument parser in src/cli/parsers/[command].js using minimist or similar (src/cli/parsers.js)
  2. Create a strategy file at src/cli/strategies/[command].js that exports an execute function (src/cli/strategies/git-cz.js)
  3. Register the strategy in src/cli/strategies.js and wire it through src/cli/parsers.js dispatch logic (src/cli/parsers.js)
  4. Add a new bin/[command].js entry point that requires and runs the CLI dispatcher (bin/git-cz.js)

Add Configuration Option Support

  1. Define the new option in src/configLoader/getNormalizedConfig.js to merge it into the standard config schema (src/configLoader/getNormalizedConfig.js)
  2. Update src/configLoader/getContent.js if the option requires custom file parsing or validation (src/configLoader/getContent.js)
  3. Pass the normalized config value through src/commitizen.js to the relevant module (adapter, commit, staging, etc.) (src/commitizen.js)

Why these technologies

  • Inquirer.js — Provides rich interactive terminal prompts for commit message composition with validation and conditional fields
  • Babel — Transpiles modern JavaScript (ES6+) in src/ to ES5-compatible dist/ for Node.js runtime and npm distribution
  • Node.js child_process — Shells out to native git commands (git add, git commit, git log) to avoid reimplementing git logic
  • Minimist/yargs-style parsers — Parses CLI flags and arguments for commands like 'cz init' and 'cz commit' with minimal overhead

Trade-offs already made

  • Adapter pattern for commit prompts

    • Why: Different projects want different commit formats (conventional-commits, custom schemas, etc.)
    • Consequence: Adds abstraction layer and configuration complexity; requires users to select or install an adapter
  • Shell out to git instead of using a git library

    • Why: Git CLI is ubiquitous, well-tested, and avoids adding large native dependencies
    • Consequence: Requires git to be installed and in PATH; harder to test in isolation; slower subprocess overhead
  • Simple in-memory cache for config and adapters

    • Why: Avoids repeated filesystem walks and module loads within a single process
    • Consequence: Cache is not persistent across process boundaries; does not handle external config changes during runtime
  • Config resolution from multiple sources (package.json, .czrc, .commitizen.json)

    • Why: Flexibility for different project structures and preferences
    • Consequence: Higher complexity in configLoader; harder to document all supported paths

Non-goals (don't propose these)

  • Does not enforce commit message conventions—that is the adapter's job
  • Does not handle server-side hook validation or CI integration
  • Does not provide a GUI or web interface
  • Does not manage versioning or changelog generation (though commitizen is often used with semantic-release)
  • Does not integrate with GitHub/GitLab directly—only reads local git state

Traps & gotchas

  1. The 'prepare' script runs npm run build before every install, but skips in CI with 'not-in-install' check—missing build in dist/ breaks requires. 2) Config path resolution uses findup.js which can pick up ancestor .czrc files; users may accidentally inherit parent repo config. 3) Adapter plugins must be npm-installed separately; bare npm install commitizen works, but cz-conventional-changelog must be added explicitly or installed globally. 4) The bin/ scripts assume Node.js is in PATH and bin/commitizen.cmd/.git-cz.cmd are Windows-specific; no auto-detection. 5) Cache in src/commitizen/cache.js is in-memory only; no persistence across sessions.

Architecture

Concepts to learn

  • Adapter/Plugin Pattern — Commitizen's extensibility hinges on dynamically loading cz- prefixed npm packages (src/commitizen/adapter.js); understanding this pattern is essential to customize commit behavior or create adapters
  • Conventional Commits — The default commit format enforced by Commitizen; understanding the spec (type, scope, description, body, footer) is required to use cz-cli or write adapters
  • File System Tree Traversal / Findup — Commitizen discovers config by walking up parent directories (src/configLoader/findup.js); critical for understanding how .czrc or package.json config is located in nested projects
  • Git Hooks / Pre-commit — Commitizen is often integrated with Git hooks (ghooks in package.json); understanding Git's hook system explains why cz replaces git commit in workflows
  • Babel Transpilation / Source Maps — The codebase uses Babel 7 to transpile ES6+ source (src/) to CommonJS (dist/); the 'prepare' script rebuilds dist/ on install, so understanding Babel is necessary for local development
  • Semantic Versioning & semantic-release — The project uses semantic-release to automate version bumps based on conventional commits; this closes the loop—cz enforces format, semantic-release reads it to version
  • Inquirer.js / Interactive CLI Prompts — While not visible in the file list, src/commitizen/commit.js orchestrates interactive prompts (the core UX of cz); adapters typically use Inquirer.js; understanding prompt flow is key

Related repos

  • commitizen/cz-conventional-changelog — Official default adapter for Commitizen; implements conventional commits schema that cz-cli loads via the adapter system
  • commitizen/cz-customizable — Alternative adapter allowing users to define custom commit types and prompts without writing JavaScript plugins
  • semantic-release/semantic-release — Downstream consumer of Commitizen commits; parses conventional commit messages generated by cz-cli to automate versioning and releases
  • husky/husky — Companion tool for Git hooks; users often pair Commitizen with Husky to enforce cz-cli on pre-commit or enforce conventional format on commit-msg
  • conventional-changelog/conventional-changelog — Related ecosystem; parses conventional commits (which cz-cli enforces) to auto-generate changelogs

PR ideas

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add comprehensive unit tests for src/commitizen/configLoader.js and its submodules

The configLoader directory has 4 modules (findup.js, getContent.js, getNormalizedConfig.js, loader.js) that handle critical configuration parsing logic. The test/tests directory structure suggests limited coverage of these modules. Configuration loading is a core feature that affects all users, and gaps here could cause silent failures when users have malformed .czrc files or invalid JSON configurations. Adding tests for edge cases (invalid-charset.json, invalid-json.json fixtures already exist but may not be fully tested) would improve reliability.

  • [ ] Create test/tests/configLoader/ directory with separate test files
  • [ ] Add unit tests for src/configLoader/findup.js - test findconfig behavior with nested directories
  • [ ] Add unit tests for src/configLoader/getNormalizedConfig.js - test all config normalization edge cases using existing fixture files
  • [ ] Add unit tests for invalid JSON and charset handling against test/fixtures files
  • [ ] Ensure test/fixtures/invalid-json-rc, invalid-json.json, invalid-charset.json are all covered

Add unit tests for src/git/* modules (add.js, commit.js, init.js, log.js, whatChanged.js)

The git submodule contains 5 files that are core to the tool's functionality (git add, commit, init, log, and whatChanged operations). These are critical integration points where failures could corrupt user repositories or lose commits. The test structure suggests minimal coverage of these git operations. Adding tests with mocked git commands would catch regressions in git integration without requiring a real repository.

  • [ ] Create test/tests/git/ directory structure
  • [ ] Add unit tests for src/git/add.js using mocked child_process or git commands
  • [ ] Add unit tests for src/git/commit.js - test commit message formatting and execution
  • [ ] Add unit tests for src/git/whatChanged.js - test diff detection logic
  • [ ] Add unit tests for src/git/init.js and src/git/log.js
  • [ ] Use sinon or similar for mocking git subprocess calls

Add GitHub Actions workflow for testing against multiple Node.js LTS versions

The .github/workflows directory contains release.yml but no dedicated test/CI workflow file. The repo uses azure-pipelines.yml for Azure Pipelines, but GitHub Actions is the industry standard for GitHub-hosted projects. Many users will run this on different Node.js versions (14, 16, 18, 20). A GitHub Actions matrix workflow would catch version-specific compatibility issues early and provide faster feedback than Azure Pipelines, especially for community contributors who expect GitHub-native CI.

  • [ ] Create .github/workflows/test.yml with Node.js matrix strategy (16.x, 18.x, 20.x)
  • [ ] Add steps: checkout, setup Node.js, npm ci, npm run build, npm test, npm run check-coverage
  • [ ] Configure to run on push to master/main and pull requests
  • [ ] Include coverage reporting integration (codecov step)
  • [ ] Ensure workflow runs before release.yml to catch issues early

Good first issues

  • Add unit tests for src/configLoader/findup.js—currently no test file visible, critical for config discovery logic: medium: Core file lacks coverage; test directory structure exists (test/tests/index.js) but findup tests are missing
  • Document adapter plugin API and create example in README—src/commitizen/adapter.js loads cz- packages but no spec visible in docs: low: Users need guidance on creating custom adapters; only cz-conventional-changelog is mentioned in package.json config
  • Add integration test for nested repo config discovery—findup.js walks upward but behavior with .czrc in parent/child repos untested: medium: Known trap (hidden gotcha above); test would clarify inheritance rules and prevent regressions

Top contributors

Recent commits

  • 3c08866 — docs: update README.md to add contributors (#985) (alexanderLinear)
  • 3ce8dd5 — fix: Close process after retry commit. Closes #974 (#1001) (jimthedev)
  • 28d96ef — docs(readme): add adapter (#972) (tal-rofe)
  • 2e57fd0 — ci(build.yml): add pnpm installation to azure pipeline (#966) (chenaski)
  • c1f4142 — feat(init): add pnpm support (#915) (chenaski)
  • 87138d3 — chore(deps) Update all non-major dependencies (renovate[bot])
  • 815c69d — fix(sec): upgrade semantic-release to 19.0.3 (#953) (pen4)
  • 0939910 — ci(release): defined a github workflow to release with semantic-release (#923) (travi)
  • 757a806 — chore(deps): update all non-major dependencies (renovate-bot)
  • 25dc80c — fix: fix the "isFunction" utility to match both "asyncFunction"s and "Function"s (#927) (tal-rofe)

Security observations

The commitizen CLI codebase has moderate security posture with several areas requiring attention. The primary concerns are around input validation in git command execution, configuration file handling, and potential path traversal vulnerabilities. The incomplete dependency information prevents full vulnerability assessment. The application should implement stricter input validation, schema validation for configs, and proper path normalization. Regular dependency auditing and security testing are recommended. As a CLI tool handling git operations, special care should be taken to prevent command injection and ensure secure credential handling.

  • High · Incomplete dependency list in package.json — package.json. The devDependencies list appears to be truncated in the provided content ('babel-p'), making it impossible to verify all dependencies for known vulnerabilities. This prevents complete security scanning of the dependency tree. Fix: Provide the complete package.json file and run 'npm audit' to identify and remediate vulnerable dependencies. Regularly update dependencies to their latest secure versions.
  • Medium · Potential command injection via git operations — src/git/*.js, src/cli/strategies/*.js. The codebase handles git operations through shell execution (evident from files like src/git/commit.js, src/git/add.js, src/git/log.js). If user input is not properly sanitized before being passed to git commands, this could lead to command injection vulnerabilities. Fix: Review all git command execution code to ensure proper input validation and sanitization. Use parameterized/escaped arguments rather than string concatenation. Consider using git libraries (e.g., simple-git, nodegit) instead of shell execution where possible.
  • Medium · Config file loading without validation — src/configLoader/. The config loader (src/configLoader/*.js, src/commitizen/configLoader.js) reads configuration from multiple sources (.commitizen, .cz.json, etc.) without clear evidence of schema validation. Malicious config files could potentially execute arbitrary code or cause security issues. Fix: Implement strict schema validation for all configuration files using a library like 'joi' or 'yup'. Whitelist allowed configuration properties and validate types. Avoid using eval() or similar dynamic code execution when processing configs.
  • Medium · Potential path traversal in configuration loading — src/configLoader/findup.js, src/commitizen/adapter.js. The findup.js config loader may be vulnerable to path traversal attacks if adapter paths or configuration locations are not properly validated, especially when resolving relative paths. Fix: Validate and normalize all file paths using path.resolve() and path.normalize(). Restrict configuration file searches to intended directories only. Implement allowlist validation for adapter paths.
  • Low · Test fixtures contain invalid JSON files — test/fixtures/invalid-json.json, test/fixtures/invalid-json-rc. The test directory contains fixtures with invalid JSON (invalid-json.json, invalid-json-rc) which could be leveraged in security testing but indicates the application handles malformed input. Fix: Ensure error handling for malformed configuration files is robust and doesn't expose sensitive information in error messages. Validate all input before processing.
  • Low · Missing security headers and HTTPS enforcement documentation — README.md, CONTRIBUTING.md. No evidence of security-related headers, HTTPS enforcement, or security policies in the codebase. While this is a CLI tool, the documentation should address security best practices. Fix: Add security documentation including guidelines for secure credential handling, recommendation to use SSH keys for git operations, and security considerations for plugin development.
  • Low · Cache implementation security unclear — src/commitizen/cache.js. The cache module (src/commitizen/cache.js) is present but its implementation details are not visible. If it stores sensitive data (like temporary commit messages or credentials), it could pose a security risk. Fix: Ensure cache files are stored with restrictive permissions (0600). Never cache sensitive information like authentication tokens. Implement automatic cache expiration and clearing on sensitive operations.

LLM-derived; treat as a starting point, not a security audit.

Where to read next


Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.

Healthy signals · commitizen/cz-cli — RepoPilot