commit-spark

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: MIT

README

Commit Spark

staged diff から、Codex CLI(ChatGPT サブスクリプション経由)で日本語 Conventional Commits メッセージを生成し、そのままコミットする CLI。


Commit Spark は aicommits の fork です。API 課金ではなく ローカルの Codex CLI(codex exec)をサブプロセスとして呼び出す ことで、ChatGPT サブスクリプションの範囲内でコミットメッセージ生成を行います。複数 AI provider の 切り替えや対話的なコミットフローは持たず、csp コマンド1つで完結します。

Setup

前提条件:

  • Go 1.25 以上(go version で確認できます。ソースからビルドする場合のみ必要です)
  • Codex CLI がインストール済みで、ChatGPT サブスクリプション でログイン済みであること(codex --version で確認できます)

winget でインストールする(Windows)

winget install NuitsJp.CommitSpark

Scoop でインストールする(Windows)

scoop bucket add nuitsjp https://github.com/nuitsjp/scoop-bucket
scoop install nuitsjp/CommitSpark

winget / Scoop でインストールした場合、csp はインストール直後からどこからでも実行でき、 更新は winget upgrade NuitsJp.CommitSpark / scoop update CommitSpark で行います (csp update はパッケージマネージャー管理下では無効です)。

ビルド済みバイナリを使う

GitHub Releases からお使いの OS・アーキテクチャ 向けのアーカイブをダウンロードし、展開した csp バイナリを PATH の通ったディレクトリに配置します。 この方法でインストールした場合は csp update で最新版へ自己更新できます。

ソースからビルドする

git clone https://github.com/nuitsjp/commit-spark.git
cd commit-spark
go build -o csp ./cmd/csp

生成された csp バイナリを PATH の通ったディレクトリに配置します。

初期設定

Codex CLI の疎通確認とコミットメッセージ形式の初期設定を行います:

csp setup

Usage

staged diff からコミットメッセージを1行生成し、そのままステージング済みの変更をコミットします:

git add <files...>
csp

変更のステージから push まで一気に行うこともできます:

csp --all --push

CLI Options

  • --all または -a: 未追跡ファイルを含む全ての変更を自動でステージする(default: false)
  • --push または -p: コミット後に現在のブランチを push する(default: false)
  • --exclude または -x: AI 解析から除外するファイル
  • --type または -t: コミットメッセージ形式。plainconventionalgitmoji に対応します
  • --prompt または -pt: LLM の挙動を調整するカスタムプロンプト
  • --version または -v: バージョン表示

Custom Prompts

--prompt フラグでコミットメッセージ生成の挙動を調整できます:

# 特定の言語で生成する
csp -pt "Write commit messages in Italian"

# 変更の特定の側面に注目させる
csp -pt "Focus on performance implications of changes"

# 特定のスタイル・トーンを指定する
csp -pt "Use technical jargon suitable for senior developers"

Subcommands

csp setup

Codex CLI が PATH 上で実行できるか確認し、コミットメッセージ形式(type)を対話的に設定します。

csp setup

csp config

設定ファイルの内容を閲覧・変更します。

csp config                          # 現在の設定を表示
csp config get <key>                # 指定したキーの値を表示
csp config set <key>=<value>        # 値を設定
csp config set locale=en type=plain # 複数同時に設定
csp config set locale=              # 値を空にするとキーを削除し既定値へ戻す

csp pr

現在のブランチとデフォルトブランチの diff から PR タイトル・本文を生成し、ブランチを push した うえで PR 作成ページをブラウザで開きます。GitHub / GitLab / Bitbucket / Azure DevOps に対応します。

csp pr

csp update

GitHub Releases から最新版を確認し、Commit Spark の実行ファイルを自己アップデートします。

csp update

Configuration

設定は OS の設定ディレクトリ下の csp/config.toml(TOML 形式)に保存されます。場所は OS ごとに 異なります(Windows: %AppData%\csp\config.toml、macOS: ~/Library/Application Support/csp/config.toml、 Linux: $XDG_CONFIG_HOME/csp/config.toml または ~/.config/csp/config.toml)。csp config set <key>=<value> で変更できます。

model

codex exec --model に渡すモデル名。未設定の場合は gpt-5.3-codex-spark が使われます。

locale

生成するコミットメッセージの言語(ISO 639-1 コード)。

未設定の場合は OS のロケール設定から自動検出します(日本語環境では ja)。検出できない場合は en にフォールバックします。

timeout

codex exec の実行タイムアウト。60s2m500ms のような期間文字列で指定します(下限 500ms)。

Default: 60s

csp config set timeout=90s
max-length

生成するコミットメッセージの最大文字数(下限 20)。

Default: 72

csp config set max-length=100
type

生成するコミットメッセージの形式:

  • plain: シンプルな非構造化メッセージ
  • conventional: Conventional Commits 形式(type + scope)
  • gitmoji: 絵文字ベースのメッセージ

Default: conventional

csp config set type=conventional
csp config set type=gitmoji
csp config set type=plain

How it works

git diff で staged changes を取得し、codex exec(Codex CLI)をサブプロセスとして起動して プロンプトとして渡し、生成されたコミットメッセージで git commit を実行します。API キーは使わず、 ローカルの Codex CLI の認証(ChatGPT サブスクリプション)をそのまま利用します。

Acknowledgements

このプロジェクトは Nutlope/aicommits の fork です。 元プロジェクトの Maintainer に感謝します。

Directories

Path Synopsis
cmd
csp command
Command csp generates a commit message from the staged diff and commits the staged changes with it.
Command csp generates a commit message from the staged diff and commits the staged changes with it.
internal
apperr
Package apperr defines the user-facing error type used across commit-spark.
Package apperr defines the user-facing error type used across commit-spark.
cli
Package cli wires commit-spark's command-line surface and orchestrates its commands.
Package cli wires commit-spark's command-line surface and orchestrates its commands.
codex
Package codex invokes the external `codex` CLI (`codex exec`) to generate text.
Package codex invokes the external `codex` CLI (`codex exec`) to generate text.
config
Package config reads and writes commit-spark's configuration file (<UserConfigDir>/csp/config.toml).
Package config reads and writes commit-spark's configuration file (<UserConfigDir>/csp/config.toml).
git
Package git wraps the git CLI operations that commit-spark needs.
Package git wraps the git CLI operations that commit-spark needs.
locale
Package locale detects the user's preferred language subtag from the OS.
Package locale detects the user's preferred language subtag from the OS.
message
Package message builds the LLM prompt for a commit message and sanitizes the model's response.
Package message builds the LLM prompt for a commit message and sanitizes the model's response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL