Skip to content

feat(commands): add /commit command - #819

Open
DeepamJha wants to merge 1 commit into
Nano-Collective:mainfrom
DeepamJha:feature/commit-message-generator
Open

feat(commands): add /commit command#819
DeepamJha wants to merge 1 commit into
Nano-Collective:mainfrom
DeepamJha:feature/commit-message-generator

Conversation

@DeepamJha

Copy link
Copy Markdown
Contributor

Closes #757

Description

Adds a new /commit slash command that generates a Conventional Commit
message from the currently staged Git diff.

The implementation follows the approach discussed in #757:

  • Checks for staged changes before making an LLM request.
  • Reads the staged diff using git diff --cached.
  • Reuses the active conversation LLM client (metadata.client) instead of
    creating a new client.
  • Uses a dedicated system prompt to generate only a Conventional Commit
    message.
  • Returns the generated message without automatically executing
    git commit.
  • Handles missing staged changes, empty model responses, and LLM errors
    using the existing message factory.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this feature for the changelog.

Testing

Automated Tests

  • Added commit.spec.tsx
  • pnpm build
  • pnpm test
  • pnpm test:lint

Manual Testing

  • Tested with OpenRouter

Verified that:

  • /commit warns when no changes are staged.
  • /commit generates a Conventional Commit message from the staged diff.
  • Model errors are surfaced through the existing error message flow.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes
  • Appropriate logging added using structured logging (see CONTRIBUTING.md#logging)

(No additional logging was required for this command.)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant