or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cli-interface.mdconfiguration.mdcore-api.mdindex.mdvalidation-rules.md
tile.json

cli-interface.mddocs/

CLI Interface

Command-line interface for linting commit messages with comprehensive options for different use cases including git hooks, CI/CD integration, and interactive usage.

Capabilities

Main CLI Command

The primary commitlint command lints commit messages against configured rules.

commitlint [input] [options]

# Examples:
commitlint                          # Read from .git/COMMIT_EDITMSG
echo 'feat: add feature' | commitlint  # Read from stdin
commitlint --edit .git/COMMIT_EDITMSG   # Read from file
commitlint --from HEAD~1 --to HEAD     # Lint commit range

Configuration Options

Control how commitlint loads and applies configuration.

--config, -g <path>        # Path to configuration file
--print-config [format]    # Print resolved config ('', 'text', 'json')
--extends, -x <preset>     # Shareable configurations to extend (array)
--parser-preset, -p <name> # Parser preset for conventional-commits-parser

Usage Examples:

# Use custom config file
commitlint --config ./custom-commitlint.config.js

# Print resolved configuration as JSON
commitlint --print-config json

# Extend multiple configurations
commitlint --extends @commitlint/config-conventional --extends @commitlint/config-lerna-scopes

# Use custom parser preset
commitlint --parser-preset conventionalcommits

Input Sources

Specify where commitlint should read commit messages from.

--edit, -e [file]        # Read from commit file or .git/COMMIT_EDITMSG
--env, -E <variable>     # Read from environment variable
--from, -f <ref>         # Lower commit range
--to, -t <ref>           # Upper commit range  
--git-log-args <args>    # Additional git log arguments as space separated string

Usage Examples:

# Read from git commit message file (git hooks)
commitlint --edit $1

# Read from environment variable
commitlint --env COMMIT_MESSAGE

# Lint commits in range
commitlint --from HEAD~5 --to HEAD

# Lint commits with additional git log args
commitlint --from HEAD~1 --git-log-args="--merges"

Output Control

Control how commitlint displays results and errors.

--format, -o <format>    # Output format
--color, -c              # Toggle colored output (boolean, default: true)
--quiet, -q              # Toggle console output (boolean, default: false)
--verbose, -V            # Enable verbose output (boolean)
--help-url, -H <url>     # Help URL in error message

Usage Examples:

# Disable colored output
commitlint --no-color

# Silent mode (no output unless errors)
commitlint --quiet

# Verbose output with detailed information
commitlint --verbose

# Custom help URL in error messages
commitlint --help-url "https://example.com/commit-guidelines"

Execution Control

Control how commitlint behaves and reports results.

--cwd, -d <directory>    # Directory to execute in (default: cwd)
--strict, -s             # Strict mode - exit code 2 for warnings, 3 for errors
--version, -v            # Display version information
--help, -h               # Display help

Usage Examples:

# Run in specific directory
commitlint --cwd /path/to/project

# Strict mode with different exit codes
commitlint --strict

Travis CI Integration

Specialized command for Travis CI environments.

commitlint-travis [options]

# Automatically detects and lints relevant commits for PRs
# Uses same options as main commitlint command

Interactive Commit Prompting

Interactive commit message creation with validation.

commit [options]

# Prompts for commit message components
# Validates against commitlint configuration
# Generates properly formatted commit messages

Exit Codes

# Normal mode
0  # Success - no issues found
1  # Failure - errors or warnings found

# Strict mode (--strict flag)
0  # Success - no issues found  
1  # Failure - unrelated errors
2  # Warnings found
3  # Errors found

Common Usage Patterns

Git Hooks Integration

# Install as commit-msg hook
echo 'npx --no -- commitlint --edit "$1"' > .git/hooks/commit-msg
chmod +x .git/hooks/commit-msg

# With Husky
npx husky add .husky/commit-msg 'npx --no-install commitlint --edit "$1"'

CI/CD Integration

# GitHub Actions / CI environments
commitlint --from HEAD~1 --to HEAD --verbose

# Travis CI (using specialized command)
commitlint-travis --verbose

# With specific configuration
commitlint --config .commitlintrc.json --from $CI_COMMIT_BEFORE_SHA --to $CI_COMMIT_SHA

Development Workflow

# Quick lint of current commit message
git log -1 --pretty=format:"%s" | commitlint

# Lint recent commits
commitlint --from HEAD~5

# Lint with verbose output for debugging
commitlint --verbose --from HEAD~1

Configuration Testing

# Print resolved configuration
commitlint --print-config json

# Test with different extends
commitlint --extends @commitlint/config-angular --print-config

# Validate configuration works
echo "feat: test message" | commitlint --config ./test-config.js