Codex Commit Generator is a VS Code extension that generates commit messages from Git diffs using a local Codex CLI and can optionally help with a reviewed commit or commit-and-push workflow from Source Control.
The extension uses Codex non-interactively through codex exec. It never runs plain interactive codex mode, never calls network APIs directly, and never commits or pushes without explicit user confirmation.
- Commands:
Codex: Generate Commit Message(codexCommit.generate)Codex: Smart Commit(codexCommit.smartCommit)Codex: Smart Commit and Push(codexCommit.smartCommitPush)
- Available in:
- Command Palette
- Source Control title area (
scm/title)
- Uses the built-in Git extension API to:
- select the active repository or prompt in multi-repo workspaces
- read staged diff by default
- optionally fallback to unstaged diff for generate-only mode
- stage changes where the Git API supports it
- commit and push where the Git API supports it
- write generated text to
repo.inputBox.value
- Uses safe
gitcommand fallbacks for staging, committing, and pushing when needed. - Runs the Codex CLI using
child_process.spawn. - Passes the prompt to
codex execas a positional argument by default. - Captures
stdoutfromcodex execand usesstdout.trim()as the commit message. - Logs repository, diff, command, stderr, exit, staging, commit, and push steps in the Output Channel.
Generates a commit message and inserts it into the Source Control input box.
This command:
- reads staged diff by default
- can fallback to unstaged diff when
codexCommit.fallbackToUnstagedis enabled - generates a message through
codex exec - writes the result to
repo.inputBox.value - does not stage, commit, or push
Generates a commit message and commits after review.
This command:
- checks for staged changes
- asks whether to stage all changes when nothing is staged
- generates a message from the staged diff
- inserts the generated message into the Source Control input box
- opens an editable review box for the final commit message
- commits only after the user confirms the reviewed message
- does not push
Generates a commit message, commits after review, then pushes after another confirmation.
This command:
- follows the same flow as Smart Commit
- asks
Commit and push to remote? - commits only after message review and push confirmation
- pushes the current branch to its configured upstream
- shows friendly errors if no upstream exists or push fails
This extension contributes the following settings:
-
codexCommit.cliCommand(string)- Codex CLI executable.
- Default:
codex - Set this to a full path if
codexis not available on PATH.
-
codexCommit.subcommand(string)- Codex CLI subcommand used for non-interactive execution.
- Default:
exec
-
codexCommit.promptTransport(argument|stdin)- How to pass the generated prompt to
codex exec. - Default:
argument argumentrunscodex exec ...extraArgs "<prompt>".stdinrunscodex exec ...extraArgsand writes the prompt to stdin. Keep this only as an optional fallback if your Codex CLI supports it in practice.
- How to pass the generated prompt to
-
codexCommit.extraArgs(string array)- Additional arguments passed after the subcommand and before the prompt.
- Default:
[] - Example:
["--model", "gpt-5.4"]
-
codexCommit.promptTemplate(string)- Prompt template sent to Codex.
- Placeholders:
{{diff}}{{diffFile}}is retained for compatibility and resolves to an empty string
- Default:
Generate a concise git commit message from this diff. Return only the commit message text. Use conventional commits if appropriate. {{diff}} -
codexCommit.useStagedOnly(boolean)- Use staged diff first in generate-only mode.
- Default:
true
-
codexCommit.fallbackToUnstaged(boolean)- If staged diff is empty, fallback to unstaged diff in generate-only mode.
- Default:
false
-
codexCommit.onExistingMessage(replace|append|prepend|ask)- How generate-only mode handles an existing Source Control commit message.
- Default:
replace
-
codexCommit.timeoutMs(number)- CLI timeout in milliseconds.
- Default:
30000
-
codexCommit.maxDiffChars(number)- Maximum diff characters included in the prompt.
- Default:
12000
-
codexCommit.confirmBeforeCommit(boolean)- Require a review step before committing.
- Default:
true - The extension still requires explicit user action before committing.
-
codexCommit.confirmBeforePush(boolean)- Use a modal confirmation before pushing in Smart Commit and Push.
- Default:
true - The extension still asks before pushing.
-
codexCommit.autoStageWhenNeeded(boolean)- Makes
Stage All Changesthe first action when Smart Commit finds no staged changes. - Default:
false - The extension still asks before staging.
- Makes
-
codexCommit.pushAfterCommitDefault(boolean)- Makes
Pushthe first action in the Smart Commit and Push confirmation. - Default:
false - The extension still asks before pushing.
- Makes
-
codexCommit.stageScope(all|trackedOnly)- Controls what gets staged when staging is requested.
- Default:
all allstages tracked and untracked changes.trackedOnlystages only tracked changes.
-
codexCommit.debug(boolean)- Enable verbose logging.
- Default:
false - When enabled, logs include the full prompt argument. Leave disabled if logs may contain sensitive code.
Default non-interactive codex exec setup:
{
"codexCommit.cliCommand": "codex",
"codexCommit.subcommand": "exec",
"codexCommit.promptTransport": "argument",
"codexCommit.extraArgs": []
}Smart Commit settings:
{
"codexCommit.confirmBeforeCommit": true,
"codexCommit.confirmBeforePush": true,
"codexCommit.autoStageWhenNeeded": false,
"codexCommit.pushAfterCommitDefault": false,
"codexCommit.stageScope": "all"
}Pass additional Codex exec flags:
{
"codexCommit.cliCommand": "codex",
"codexCommit.subcommand": "exec",
"codexCommit.promptTransport": "argument",
"codexCommit.extraArgs": ["--model", "gpt-5.4"]
}Use stdin only if your codex exec installation supports prompt input through stdin:
{
"codexCommit.promptTransport": "stdin"
}If stdin mode fails with a terminal-related error such as stdin is not a terminal, switch back to:
{
"codexCommit.promptTransport": "argument"
}Generate only:
- Stage your changes.
- Open Source Control.
- Run
Codex: Generate Commit Message. - Review the generated message in the Source Control commit input.
- Commit manually when ready.
Smart Commit:
- Stage changes, or let the extension ask whether to stage all changes.
- Run
Codex: Smart Commit. - Review or edit the generated commit message.
- Press Enter to commit, or cancel to stop.
Smart Commit and Push:
- Stage changes, or let the extension ask whether to stage all changes.
- Run
Codex: Smart Commit and Push. - Review or edit the generated commit message.
- Confirm
Commit and push to remote?. - The extension commits, then pushes to the configured upstream.
npm install
npm run compileThen press F5 in VS Code to launch an Extension Development Host.
- No OpenAI SDK is used.
- No direct network calls are made by this extension.
- The extension never commits or pushes without confirmation.
codexCommit.inputModehas been removed. UsecodexCommit.promptTransportinstead.