gh-sparkle

Crates.iogh-sparkle
lib.rsgh-sparkle
version0.1.0
created_at2026-01-23 07:30:08.635603+00
updated_at2026-01-23 07:30:08.635603+00
descriptionGenerate AI-powered commit messages
homepage
repositoryhttps://github.com/dyxushuai/gh-sparkle
max_upload_size
id2063726
size105,169
John Xu (dyxushuai)

documentation

README

CLI output sample

$gh <✨/sparkle>

CI

A GitHub CLI extension that brings VS Code's "Generate Commit Message" flow to your terminal. It reads staged changes, asks GitHub Models for a Conventional Commit message, and commits it automatically.

Why sparkle

The name comes from the ✨/sparkle icon in VS Code's "Generate Commit Message" action. I wanted the same flow inside gh: stage, generate, commit.

Features

  • Copilot-style commit message generation from staged diffs
  • Handles large changes with summary + trimming
  • Defaults to auto with safe input trimming for large changes
  • Supports --language, --examples, and --model
  • Commits staged changes automatically

Installation

gh extension install dyxushuai/gh-sparkle

Usage

Stage your changes and run:

git add .
gh sparkle

Options

  • -l, --language <LANGUAGE>: Output language for the commit message. Default: english.
  • -e, --examples[=<N>]: Include recent commit messages as examples. If provided without a value, it uses 3. Valid range: 1..=20.
  • -m, --model <MODEL>: GitHub Models model to use. Default: auto (resolved via modelPolicy.autoModels in the prompt config, tried in order until a request succeeds).
# Generate commit message in a different language
gh sparkle --language chinese

# Add previous commit messages as examples (default 3 when flag is present)
gh sparkle --examples

# Or specify the number of examples (max 20)
gh sparkle --examples 5

# Use a different GitHub Models model
gh sparkle --model xai/grok-3-mini

Prerequisites

  • GitHub CLI installed and authenticated (gh auth login)
  • A git repository with staged changes

If you use GitHub Enterprise, make sure your host is authenticated:

gh auth login --hostname <your-host>

Notes

  • The extension commits automatically using the generated message.
  • If there are no staged changes, it exits without committing.
  • Large diffs are truncated to fit model input limits.

Upgrade

gh extension upgrade sparkle

Large changes handling

For big diffs, it summarizes and trims input, then retries with a smaller budget when needed. Input budgets and model policy are defined in assets/commitmsg.prompt.yml.

Commit count: 36

cargo fmt