Skip to content

create commit-message

create commit-message - Generate AI-powered commit messages from staged changes

The create commit-message command uses AI to analyze your staged git changes and generate a structured, conventional commit message that follows project standards and includes module-specific details. The generated message includes a top-level summary and per-module sections describing changes. All output is validated against the commit message contract to ensure consistency and quality. By default, the command outputs the commit message to stdout. Use --debug to save intermediate outputs. Use --commit to automatically create a git commit with the generated message.

Flags

Flag Description
-d, --debug (default: false) Enable debug mode to save intermediate outputs (context, prompts, AI responses) to the 'out' directory for troubleshooting and analysis
-c, --commit (default: false) Automatically create git commit with generated message

Notes

Expected Output:

  • Structured conventional commit message to stdout
  • Top-level summary and per-module sections
  • Validated against commit message contract
  • Debug outputs in out/ if --debug enabled

How It Works

The command uses AI generation with format support:

  • Format: Generates plaintext commit messages following conventional commit format (type, scope, description, body)
  • Validation: Validates message format and structure automatically
  • Retry: If validation fails, AI receives error feedback and regenerates improved output
  • Customization: Uses three-tier prompt system for team-specific commit message styles

Supported formats: Conventional commits with module-aware sections for monorepo commits.

Custom Prompts

Customize AI behavior using the three-tier prompt system. Prompts are loaded with the following priority:

  1. Command Flag (highest priority)
r2r eac create commit-message --prompt /path/to/custom.md
  1. Team Override (version controlled)

  2. Location: .r2r/eac/templates/ai/commit-message/

  3. Committed to git, affects entire team

  4. System Default (fallback)

  5. Location: templates/ai/commit-message/
  6. Shipped with r2r

Available Prompts

Prompt File Purpose Override Location
module.md Multi-module commit sections .r2r/eac/templates/ai/commit-message/module.md
top-level.md Top-level commit header .r2r/eac/templates/ai/commit-message/top-level.md

Creating Team Overrides

# Copy system default
cp templates/ai/commit-message/module.md .r2r/eac/templates/ai/commit-message/module.md

# Edit for your team's style
nano .r2r/eac/templates/ai/commit-message/module.md

# Commit to git
git add .r2r/eac/templates/ai/commit-message/
git commit -m "chore(eac): customize commit message prompt"

# Test with debug flag to verify
r2r eac create commit-message --debug

See Also


Tutorials | How-to Guides | Explanation | Reference

You are here: Reference — information-oriented technical descriptions of the system.