Home/Tools/@tpmjs/tools-conventional-commit-suggest

conventionalCommitSuggest

@tpmjs/tools-conventional-commit-suggest

Suggests a conventional commit message based on a description of changes and optionally a list of changed files. Follows the Conventional Commits specification with types like feat, fix, docs, etc. Useful for maintaining consistent commit history.

Official
engineering
v0.2.0
MIT

Interactive Playground

Test @tpmjs/tools-conventional-commit-suggest (conventionalCommitSuggest) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install @tpmjs/tools-conventional-commit-suggest
pnpm add @tpmjs/tools-conventional-commit-suggest
yarn add @tpmjs/tools-conventional-commit-suggest
bun add @tpmjs/tools-conventional-commit-suggest
deno add npm:@tpmjs/tools-conventional-commit-suggest

2. Import the tool

import { conventionalCommitSuggest } from '@tpmjs/tools-conventional-commit-suggest';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { conventionalCommitSuggest } from '@tpmjs/tools-conventional-commit-suggest';

const result = await generateText({
  model: openai('gpt-4o'),
  tools: { conventionalCommitSuggest },
  prompt: 'Your prompt here...',
});

console.log(result.text);

Parameters

Available configuration options

Auto-extracted
description
Required
Type: string

Description of the changes made (e.g., "fixed login bug", "added dark mode")

files
Optional
Type: array

Optional array of changed file paths to help determine scope

Schema extracted: 1/1/2026, 8:17:38 AM

README

@tpmjs/tools-conventional-commit-suggest

Suggests conventional commit messages from descriptions or file changes following the Conventional Commits specification.

Installation

npm install @tpmjs/tools-conventional-commit-suggest

Usage

import { conventionalCommitSuggest } from '@tpmjs/tools-conventional-commit-suggest';
import { generateText } from 'ai';

const result = await generateText({
  model: yourModel,
  tools: {
    conventionalCommitSuggest,
  },
  prompt: 'Suggest a commit message for adding a new login feature',
});

Tool Details

conventionalCommitSuggest

Suggests a conventional commit message based on a description of changes and optionally a list of changed files.

Parameters:

  • description (string, required) - Description of the changes made
  • files (array of strings, optional) - Changed file paths to help determine scope

Returns:

{
  message: string;        // The commit message subject line
  type: CommitType;       // feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
  scope: string | null;   // The scope (usually derived from files)
  breaking: boolean;      // Whether this is a breaking change
  body: string | null;    // Optional commit body
  fullMessage: string;    // Complete commit message with body
  explanation: string;    // Explanation of the commit type
}

Example Output

Input:

{
  description: "added dark mode toggle to settings page",
  files: ["src/components/settings/ThemeToggle.tsx", "src/components/settings/Settings.tsx"]
}

Output:

{
  message: "feat(settings): add dark mode toggle to settings page",
  type: "feat",
  scope: "settings",
  breaking: false,
  body: "Files changed:\n- src/components/settings/ThemeToggle.tsx\n- src/components/settings/Settings.tsx",
  fullMessage: "feat(settings): add dark mode toggle to settings page\n\nFiles changed:\n- src/components/settings/ThemeToggle.tsx\n- src/components/settings/Settings.tsx",
  explanation: "A new feature"
}

Conventional Commits Specification

This tool follows the Conventional Commits specification:

Commit Types

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that don't affect code meaning (formatting, whitespace)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Performance improvement
  • test: Adding or updating tests
  • build: Changes to build system or dependencies
  • ci: Changes to CI/CD configuration
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit

Format

<type>(<scope>): <subject>

<body>

<footer>

Breaking Changes

Breaking changes are indicated with ! after the type/scope:

feat(api)!: remove deprecated endpoints

Features

  • Automatically determines commit type from description
  • Extracts scope from file paths
  • Detects breaking changes
  • Generates commit body with file list
  • Follows Conventional Commits specification
  • Provides explanation for suggested type

License

MIT

Statistics

Downloads/month

34

Quality Score

77%

Bundle Size

NPM Keywords

tpmjs
engineering
git
commit
conventional-commits

Maintainers

thomasdavis(thomasalwyndavis@gmail.com)

Frameworks

vercel-ai