Skip to content

[Feature] nanocoder commit (Auto-Commit Message Generator) #757

Closed

Description

@akramcodez

Description

A dedicated CLI flag or slash command (/commit) that strictly reads the current git diff and generates a conventional commit message.

Use Case

Developers often struggle with writing good commit messages. While they can ask Nanocoder "write a commit message for my changes", having a dedicated shortcut is much faster and guarantees a consistent, formatted output without conversational fluff.

Proposed Solution

Running nanocoder --commit (or typing /commit in the extension) will automatically fetch git diff --staged, send it to the model with a strict system prompt, and return just the message. Optionally, it could offer to actually execute the commit.

Alternatives Considered

  • Forcing the user to manually type the prompt, which is repetitive.

Additional Context

  • I have searched existing issues to ensure this is not a duplicate
  • This feature aligns with the project's goals (local-first AI assistance)

Implementation Notes (optional)

  • This is a highly requested feature in tools like Aider. It bypasses the standard "chat" loop and acts as a one-shot utility.

Contribution Guidelines

  • If you would like to work on this issue, please comment below to ask for assignment first.
  • Before opening a Pull Request, please briefly share your implementation plan in this thread so we can align on the approach!

Activity

  1. added
    enhancement
    on Aug 3, 2026
  2. DeepamJha commented on Aug 4, 2026

    @DeepamJha
    Contributor

    Hi @akramcodez, I'd like to work on this. I have two PRs currently open (#740, #761) but nothing else actively assigned, so happy to take this on. Could you assign it to me?

  3. akramcodez commented on Aug 4, 2026

    @akramcodez
    MemberAuthor

    sure @DeepamJha if you need any help just let me know

  4. DeepamJha commented on Aug 5, 2026

    @DeepamJha
    Contributor

    @akramcodez

    I've finished investigating the existing command architecture and this is the implementation I'm planning.

    Scope

    • Add a /commit command that reads the staged git diff.
    • Generate a conventional commit message.
    • Display the generated message only (no automatic git commit execution).

    Implementation

    1. Use hasStagedChanges() to detect an empty index.
    2. Return a warning if nothing is staged.
    3. Fetch the staged diff with execGit(["diff", "--cached"]).
    4. Generate the message with a conventional-commit prompt and return it via the existing message factory.

    Tests

    • Empty staged diff.
    • Successful generation (mocked LLM).
    • LLM failure/error handling.

    One question before I start: I couldn't find an existing slash command that reuses metadata.client; my current plan is to create the client via createLLMClient(). If there's a preferred pattern for slash commands, I'm happy to follow it instead.

  5. DeepamJha commented on Aug 9, 2026

    @DeepamJha
    Contributor

    Hi @akramcodez, just checking in on #819 when you get a chance as all automated checks are passing, and I'm happy to address any review feedback. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions