scg is a Swift-based command line tool that inspects your current Git repository, summarizes the staged and unstaged changes, and generates a commit message proposal with Apple's on-device generative model. The goal is to keep human-in-the-loop Git commits fast, consistent, and privacy-preserving by relying on system-provided AI capabilities instead of cloud services.
CommitGen.mov
- Detects dirty Git worktrees and extracts concise change context
- Crafts commit message drafts with Apple's onboard generative APIs
- Provides an interactive acceptance/edit flow before writing the commit
- Persists CLI defaults with an interactive
configcommand - Respects local-only privacy requirements (no network calls)
The CLI currently supports end-to-end commit generation, including Git inspection, AI-assisted drafting, interactive editing, optional auto-staging/committing, and persistent configuration defaults. Advanced batching for huge diffs is available and continues to evolve based on real-world feedback.
- macOS 26 (Sequoia) or later with the Apple Intelligence feature set enabled
- Xcode 26 (or newer) with the command line tools installed (
xcode-select --install) - Swift 6 toolchain (ships with Xcode 26)
- Git 2.40+ available on
PATH - Full Disk Access enabled for the Terminal (or your preferred shell) so the FoundationModels framework can initialize properly
brew tap Iron-Ham/swift-commit-gen
brew install scgOr install directly without tapping:
brew install Iron-Ham/swift-commit-gen/scg- Clone the repository:
git clone https://github.com/Iron-Ham/swift-commit-gen.git cd swift-commit-gen - Run the bundled install script (installs into
~/.local/binby default):Pass a custom destination as the first argument to install elsewhere, e.g.Scripts/install.sh
Scripts/install.sh /usr/local/bin.
If you prefer manual installation, build and copy the binary yourself:
git clone https://github.com/Iron-Ham/swift-commit-gen.git
cd swift-commit-gen
swift build -c release
install -d "$HOME/.local/bin"
install .build/release/scg "$HOME/.local/bin/"Add export PATH="$HOME/.local/bin:$PATH" to your shell profile if needed.
- The first invocation may prompt for Apple Intelligence access; approve the request in System Settings → Privacy & Security → Apple Intelligence.
- If
scgreports that the model is unavailable, ensure Apple Intelligence is enabled and the device satisfies the on-device requirements.
From the root of a Git repository with pending changes:
swift run scg generateOr, after installation:
scg generateYou can invoke the tool either with the explicit generate subcommand or omit it because generate is the default subcommand.
Primary (shorter) form:
scg [OPTIONS]Equivalent explicit form:
scg generate [OPTIONS]- Inspect repository (staged changes only)
- Summarize diff and plan prompt batches if large
- Request draft commit message from on-device model
- Interactive review loop (accept / edit / regenerate)
- Optional auto-commit
| Flag | Short | Description | Default | Notes |
|---|---|---|---|---|
--format <text|json> |
Output format for the draft | text |
JSON skips the interactive review loop. | |
--commit / --no-commit |
Apply the accepted draft with git commit |
On | --no-commit leaves the draft uncommitted. |
|
--stage |
Stage all pending changes (including untracked) before drafting | Off | Equivalent to git add --all before generation. |
|
--no-stage |
Disable staging, even if configured as a default | - | Wins over stored auto-stage preferences. | |
--verbose |
-v |
Emit detailed prompt diagnostics and debug lines | Off | Shows [DEBUG] messages. Overrides --quiet. |
--no-verbose |
Force verbose output off, even if configured as default | - | Useful for scripts overriding stored settings. | |
--quiet |
-q |
Suppress routine info lines | Off | Hides [INFO] but keeps [NOTICE], warnings, errors. Ignored if --verbose is present. |
--no-quiet |
Ensure quiet mode is disabled, even if configured | - | Helpful when scripts need full output. | |
--single-file |
Analyze each file independently and then combine per-file drafts | Off | Sends a larger diff slice per file, useful when you need high-fidelity summaries. |
The logger uses distinct levels to balance clarity and noise:
[ERROR]: Fatal issues preventing progress[WARNING]: Non-fatal problems or user action advisories[NOTICE]: Essential workflow milestones (always shown, even with--quiet)[INFO]: Routine progress details (hidden with--quiet)[DEBUG]: High-volume diagnostics (only with--verbose)
Precedence: --verbose > --quiet. Supplying both yields verbose output.
Generate and interactively accept a draft (default):
scgAuto-commit the already staged changes:
scg --commitStage everything first, then show verbose diagnostics:
scg --stage --verboseMinimal essential output (quiet mode) but still commit:
scg --quiet --commitProduce machine-readable JSON (no interactive loop):
scg --format jsonRequest high-fidelity per-file drafts before they are combined:
scg --single-fileUse the config subcommand to inspect or update stored defaults. Running it with no flags opens an interactive, colorized editor that walks through each preference:
scg configAvailable options:
| Flag | Description |
|---|---|
--show |
Print the current configuration without making changes. |
--auto-stage-if-clean <true|false> |
Persist whether generate should stage all files when nothing is staged. |
--clear-auto-stage |
Remove the stored auto-stage preference. |
--verbose <true|false> |
Set the default verbose logging preference. |
--clear-verbose |
Remove the stored verbose preference. |
--quiet <true|false> |
Set the default quiet logging preference. |
--clear-quiet |
Remove the stored quiet preference. |
When no options are provided, the command detects whether the terminal is interactive and presents guided prompts with recommended defaults highlighted. Stored settings live in ~/Library/Application Support/scg/config.json.
For a full list of commands:
scg help # or scg -hFor help with a specific command, such as generate:
scg help generate # or scg generate -h