VOOZH about

URL: https://deepwiki.com/guanguans/ai-commit/3.2-command-options-and-flags

⇱ Command Options and Flags | guanguans/ai-commit | DeepWiki


Loading...
Menu

Command Options and Flags

This page is a complete reference for all CLI options and arguments accepted by the commit and config commands. It documents what each flag does, its default value, and which config key it corresponds to.

For a narrative walkthrough of how the commit command uses these options end-to-end, see 3.1 For details on the underlying configuration system that supplies default values, see 3.3 and 7.1


commit Command

The commit command is defined in app/Commands/CommitCommand.php and registered as the default command.

Usage:

ai-commit commit [options] [--] [<path>]

Arguments

ArgumentRequiredDescriptionDefault
pathNoWorking directory for all git subprocess callsCurrent working directory (ConfigManager::localPath(''))

The path argument is passed as the cwd for every Process instance created inside CommitCommand. See app/Commands/CommitCommand.php268-282


Options

All options are defined in CommitCommand::configure() at app/Commands/CommitCommand.php132-190

--generator / -g

PropertyValue
Short form-g
AcceptsA single string value
DefaultValue of generator key in resolved config (typically openai_chat)
Config keygenerator

Selects the AI generator driver to use. The value must match a key in the generators array in config/ai-commit.php. Tab completion suggests valid values from configManager->get('generators', []).


For a list of available generator names, see 3.4


--prompt / -p

PropertyValue
Short form-p
AcceptsA single string value
DefaultValue of prompt key in resolved config (typically conventional)
Config keyprompt

Selects which named prompt template to use when constructing the request to the AI backend. The value must match a key in the prompts map. Tab completion suggests valid values from configManager->get('prompts', []).


For prompt template configuration, see 7.3


--commit-options

PropertyValue
Short formnone
AcceptsMultiple string values (repeatable)
DefaultValue of commit_options in config (default: ["--edit"])
Config keycommit_options

Appends extra flags to the underlying git commit invocation. The full command constructed is git commit --message <message> [commit-options...]. See app/Commands/CommitCommand.php226-234


The --no-edit and --no-verify flags are appended on top of whatever this option contains.


--diff-options

PropertyValue
Short formnone
AcceptsMultiple string values (repeatable)
DefaultValue of diff_options in config (default: [":!*-lock.json", ":!*.lock", ":!*.sum"])
Config keydiff_options

Appends extra flags to the git diff --cached command that collects the staged diff. The default exclusions prevent lock files from inflating the diff. See app/Commands/CommitCommand.php218-221



--no-edit

PropertyValue
Short formnone
AcceptsFlag (no value)
Defaultfalse (or value of no_edit in config)
Config keyno_edit

When present, passes --no-edit to git commit, suppressing the editor that would normally open. If the terminal does not support TTY (Process::isTtySupported() returns false), --no-edit is automatically applied regardless of this flag. See app/Commands/CommitCommand.php284-292



--no-verify

PropertyValue
Short formnone
AcceptsFlag (no value)
Defaultfalse (or value of no_verify in config)
Config keyno_verify

When present, passes --no-verify to git commit, bypassing pre-commit and commit-msg git hooks. See app/Commands/CommitCommand.php295-297



--dry-run

PropertyValue
Short formnone
AcceptsFlag (no value)
Defaultfalse
Config keynone

Generates the commit message and prints it, but does not execute git commit. Useful for previewing what would be committed. See app/Commands/CommitCommand.php91-97



--diff

PropertyValue
Short formnone
AcceptsAn optional string value
Defaultnone (falls back to running git diff --cached)
Config keynone

Allows passing diff content directly as a string, bypassing the git diff --cached subprocess entirely. Primarily useful for testing or scripted pipelines. See app/Commands/CommitCommand.php58-64



--config / -c

PropertyValue
Short form-c
AcceptsAn optional file path string
Defaultnone
Config keynone

Loads a custom JSON config file and merges it over the active configuration before the command runs. When provided, it also re-applies commit_options, diff_options, generator, and prompt values from that file into the current input options. See app/Commands/CommitCommand.php198-216



Framework-Inherited Options

These options are provided by the Laravel Zero / Symfony Console foundation and apply to all commands.

OptionDescription
-h, --helpDisplay command help
-q, --quietSuppress all output
-V, --versionDisplay application version
--ansi / --no-ansiForce or disable ANSI color output
-n, --no-interactionDisable all interactive prompts
--env[=ENV]Set the application environment
-v / -vv / -vvv, --verboseIncrease output verbosity; -vvv (debug) will print each git command line before running it

Note: --verbose at debug level causes CommitCommand to output the full command string of every Process it creates. See app/Commands/CommitCommand.php278-280


Option Resolution Diagram

The following diagram shows how the final value for each runtime option is resolved, from lowest to highest precedence.

Commit Option Value Resolution


Sources: app/Commands/CommitCommand.php132-216 app/ConfigManager.php62-80


config Command

The config command is defined in app/Commands/ConfigCommand.php It manages the JSON config files used by ai-commit.

Usage:

ai-commit config <action> [<key>] [<value>] [options]

For full details on config file locations and the merge hierarchy, see 3.3

Arguments

ArgumentRequiredDescription
actionYesOne of: set, get, unset, reset, list, edit
keyNoDot-notation config key (e.g. generators.openai_chat.api_key)
valueNoString or JSON value to assign

The ACTIONS constant is defined at app/Commands/ConfigCommand.php32


Actions

Actionkey requiredvalue requiredDescription
setYesYesSets key to value and writes to the config file. JSON strings are decoded automatically.
getNoNoPrints the value of key, or the entire config as JSON if key is omitted.
unsetYesNoRemoves key from the config file.
resetNoNoResets key to its default value from config/ai-commit.php, or resets the entire config if key is omitted.
listNoNoPrints all config entries in dot-notation format.
editNoNoOpens the config file in an interactive editor (auto-detected or specified via --editor).

The action dispatch logic is in ConfigCommand::handle() at app/Commands/ConfigCommand.php55-113


Options

All options are defined in ConfigCommand::configure() at app/Commands/ConfigCommand.php152-162

--global / -g

PropertyValue
Short form-g
AcceptsFlag (no value)
Defaultfalse

When present, applies the action to the global config file at ~/.ai-commit/.ai-commit.json (resolved by ConfigManager::globalPath()). When absent, the action targets the local .ai-commit.json in the current working directory.



--file / -f

PropertyValue
Short form-f
AcceptsAn optional file path string
Defaultnone

Specifies an explicit file path to operate on, overriding both the local and global defaults. Takes precedence over --global. See app/Commands/ConfigCommand.php177-188



--editor / -e

PropertyValue
Short form-e
AcceptsAn optional editor binary name or path
DefaultAuto-detected from PATH

Used only with the edit action. Specifies the editor executable. If not provided, ConfigCommand searches for available editors in this priority order:

  • Unix/macOS: editor, vim, vi, nano, pico, ed
  • Windows: notepad

See app/Commands/ConfigCommand.php190-205



Config Command Flow Diagram

ConfigCommand Action Dispatch


Sources: app/Commands/ConfigCommand.php55-113 app/Commands/ConfigCommand.php152-175


Option-to-Config Key Mapping

The following table shows which config keys supply the default values for commit command options. When you set a config key, you permanently change the default for that option across all runs.

CLI OptionConfig KeyExample Config Set Command
--generatorgeneratorconfig set generator moonshot
--promptpromptconfig set prompt conventional
--commit-optionscommit_optionsconfig set commit_options '["--signoff"]'
--diff-optionsdiff_optionsconfig set diff_options '[":!*.min.js"]'
--no-editno_editconfig set no_edit true
--no-verifyno_verifyconfig set no_verify true

Sources: app/Commands/CommitCommand.php132-190 config/ai-commit.php14-76


Cross-Command Option Interaction Diagram

This diagram maps CLI flags to the code entities that consume them.

Flag → Code Entity Map


Sources: app/Commands/CommitCommand.php52-105 app/Commands/CommitCommand.php218-297 app/Commands/ConfigCommand.php55-205