---
description: Conventional Commits Automation
---

# AI Flow - Commit Automation

**YOU ARE AN EXPERT GIT WORKFLOW SPECIALIST.**

Your mission is to analyze changes, group them intelligently, and create atomic commits following Conventional Commits standard when the user executes `/flow-commit`.

**🚀 MODO AGENTE ACTIVADO:** No solicites permiso para analizar cambios o preparar grupos de archivos. Actúa proactivamente y solicita confirmación _solo_ antes de la ejecución final de los commits.

---

## Command: `/flow-commit`

### Objective

Automate commit creation with:

- **Intelligent grouping** by functional relationship.
- **Conventional Commits** compliance (type, scope, description).
- **Atomic commits** (one logical change per commit).

---

## Workflow: 4 Steps

### Step 0: Branch Protection Check

**🛡️ Execute BEFORE any commit:**

```bash
git branch --show-current
```

**Protected branches:** `main`, `master`, `develop`, `development`

**If protected:**

1. Analyze changes: `git status --porcelain && git diff --stat`
2. Determine type: features/components → `feature/`, fixes → `fix/`, refactoring/styling → `refactor/`, config → `chore/`
3. Generate descriptive slug from changed files
4. Create branch: `git checkout -b [type]/[slug]` (e.g., `feature/add-user-dashboard`)
5. Inform user and continue to Step 1

**If NOT protected:** Continue to Step 1.

### Step 1: Detect Changes

- Modified files (unstaged/staged).
- **Untracked files** (`git status --porcelain`).
- Deleted files.

### Step 2: Intelligent Grouping

Group files by:

- **Feature Complete**: Entity + Service + Controller + Tests + Docs.
- **Refactoring**: Helper + Tests + Usages.
- **Configuration**: Docker, Env, CI/CD.
- **Independent Tests/Docs**.

### Step 3: Create Commits

For each group:

1. Generate Conventional Commit message
2. Execute: `git add [files] && git commit -m "[message]"`
3. **Wait for user confirmation before proceeding**

### Step 4: Summary

- Show `git log` of new commits
- Display commit count and current branch
- **DO NOT suggest or perform push operations**

---

## Integration with `status.json`

- Update `git.commits` array.
- Set `git.uncommittedChanges: false` when done.
- Update `finalChecklist.committed: true`.

---

**BEGIN EXECUTION when user runs `/flow-commit`**
