feat: add commit command with AI-generated messages#1730
Merged
tusharmath merged 94 commits intomainfrom Nov 12, 2025
Merged
Conversation
Add configurable max_diff_size parameter to generate_commit_message to control git diff truncation. This prevents sending excessively large diffs to AI models, reducing token usage and API costs. Includes comprehensive documentation and truncation notices in the prompt context.
4f30aeb to
36c07b4
Compare
Execute git log, branch name, and diff commands concurrently using tokio::join! to reduce latency. Also parallelize template rendering and provider/model retrieval. Add branch name to commit message prompt context.
Replace default value of 0 with None for unlimited diff size in commit message generation. Update API signatures, documentation, and truncation logic to use Option<usize> for clearer semantics.
tusharmath
reviewed
Oct 15, 2025
tusharmath
reviewed
Oct 15, 2025
tusharmath
reviewed
Oct 15, 2025
Move commit message generation logic from ForgeApp to new GitApp class to improve separation of concerns and modularity. This change isolates git-related functionality and makes the codebase more maintainable.
Allow commit command to work with unstaged changes as fallback when no files are staged. Add parallel fetching of both staged and unstaged diffs, then use staged if available, otherwise unstaged. Update commit execution to use `-a` flag when no files are staged to include all tracked changes.
…es detection Replace `.success()` with explicit exit code comparison to handle the specific behavior where exit code 1 indicates staged files exist, avoiding reliance on the general success check which may not accurately reflect the git diff-index semantics.
Add a new `/commit` CLI command that generates AI-powered commit messages with flexible syntax support. The command accepts optional `preview` flag to display the message without committing, and `max-diff-size` parameter to limit the diff size sent to the AI model.
Replace heredoc-based commit message passing with direct -m flag for cleaner command execution and improved shell compatibility.
Collaborator
|
FIXME
|
tusharmath
reviewed
Nov 3, 2025
…l command output - Remove `preview` flag from `/commit` command - always preview message - Pre-fill editor buffer with `git commit` command for user to execute - Refactor Console to maintain persistent ForgeEditor instance - Add `set_buffer()` method to ForgeEditor and Console for pre-filling input - Update commit command handling to generate shell command with proper flags - Simplify error handling by using `to_string()` instead of debug formatting - Update tests to reflect removal of preview parameter
- Remove unused GitAppError import - Simplify error display formatting by removing intermediate variable - Remove special case handling for NoChangesToCommit error - Fix line length formatting for git commit command
… for commit messages
tusharmath
added a commit
that referenced
this pull request
Nov 18, 2025
tusharmath
added a commit
that referenced
this pull request
Nov 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes: #1728
--preview: Analyzes your git diff, generates an AI commit message, and commits immediately--preview: Shows the proposed commit message for review without committing