commit-spark

module
v0.1.0 Latest Latest
Warning

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

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

README

commit-spark

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


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

Setup

前提条件:

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

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

GitHub Releases からお使いの OS・アーキテクチャ 向けのアーカイブをダウンロードし、展開した csp バイナリを PATH の通ったディレクトリに配置します。

ソースからビルドする

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

git commit と組み合わせて使います:

git commit -m "$(csp)"

CLI Options

  • --all または -a: 追跡済みファイルの変更を自動でステージする(default: false)
  • --exclude または -x: AI 解析から除外するファイル
  • --type または -t: コミットメッセージ形式(default: conventional)。plainconventionalgitmoji に対応します。csp は常に1行だけを出力するため、conventional+bodyconventional に、subject+bodyplain に丸められます
  • --prompt または -p: LLM の挙動を調整するカスタムプロンプト
  • --version または -v: バージョン表示

Custom Prompts

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

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

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

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

Subcommands

csp setup

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

csp setup

csp config

設定ファイル(~/.csprc)の内容を閲覧・変更します。

csp config                          # 現在の設定を表示
csp config get <key>                # 指定したキーの値を表示
csp config set <key>=<value>        # 値を設定
csp config set locale=en type=plain # 複数同時に設定

csp pr

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

csp pr

csp update

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

csp update

Configuration

設定は ~/.csprc(ini 形式)に保存されます。csp config set <key>=<value> で変更できます。

MODEL

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

locale

Default: ja(csp 実行時、未設定であれば自動で ja が使われます)

生成するコミットメッセージの言語。ISO 639-1 コードの一覧を参照してください。

timeout

codex exec の実行タイムアウト(ミリ秒)。

Default: 60000(60秒)

csp config set timeout=90000 # 90秒
max-length

生成するコミットメッセージの最大文字数。

Default: 72

csp config set max-length=100
type

Default: conventional(csp 実行時、未設定であれば自動で conventional が使われます)

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

  • plain: シンプルな非構造化メッセージ
  • conventional: Conventional Commits 形式(type + scope)
  • gitmoji: 絵文字ベースのメッセージ
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)をサブプロセスとして起動して プロンプトとして渡し、生成されたコミットメッセージを標準出力に返します。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 prints it to stdout.
Command csp generates a commit message from the staged diff and prints it to stdout.
internal
apperr
Package apperr defines the "known error" marker type used throughout commit-spark.
Package apperr defines the "known error" marker type used throughout commit-spark.
codexcli
Package codexcli invokes the external `codex` CLI to generate text.
Package codexcli invokes the external `codex` CLI to generate text.
commitmsg
Package commitmsg builds the LLM prompt for a commit message and sanitizes the model's response.
Package commitmsg builds the LLM prompt for a commit message and sanitizes the model's response.
config
Package config reads and writes commit-spark's configuration file (~/.csprc, ini format).
Package config reads and writes commit-spark's configuration file (~/.csprc, ini format).
gitutil
Package gitutil wraps the git CLI operations needed by commit-spark.
Package gitutil wraps the git CLI operations needed by commit-spark.

Jump to

Keyboard shortcuts

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