diff --git a/README.md b/README.md index 98a74a2..71c3267 100644 --- a/README.md +++ b/README.md @@ -288,10 +288,13 @@ export GROQ_API_KEY="your-api-key" ## Usage ```bash -# Basic: stage + generate + confirm + commit -git add . +# Basic: stage files + generate + confirm + commit +git add file1.ts file2.ts git-commit-ai +# Stage all changes and commit +git-commit-ai --all + # Auto-commit without confirmation git add . git-commit-ai -y @@ -300,6 +303,9 @@ git-commit-ai -y git add . git-commit-ai --push +# Stage all changes and commit (equivalent to git add . && git-commit-ai) +git-commit-ai --all + # Commit each modified file separately git-commit-ai --individual @@ -454,6 +460,7 @@ ignore_patterns = ["dist/*", "*.generated.ts"] | Option | Description | |--------|-------------| +| `-a, --all` | Stage all changes before committing | | `-p, --push` | Push after commit | | `-y, --yes` | Skip confirmation | | `-i, --individual` | Commit files individually | diff --git a/src/cli.ts b/src/cli.ts index d2b059f..d6b4b4f 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -409,6 +409,7 @@ export function createProgram(): Command { .option("--issue ", "Reference an issue (e.g., 123 or #123)") .option("--breaking", "Mark as breaking change (adds ! to type)") .option("--co-author ", "Add co-author (can be used multiple times)", (val: string, prev: string[]) => prev.concat([val]), [] as string[]) + .option("-a, --all", "Stage all changes before committing") .action(async (options) => { if (options.debug) { enableDebug(); @@ -537,8 +538,8 @@ export function createProgram(): Command { coAuthors: options.coAuthor, }; - // Don't stage files if amending - if (!options.amend) { + // Stage all files only if --all flag is used + if (options.all && !options.amend) { addFiles("."); }