Padrões de Commit¶
Regra de Ouro: Nunca Commit na Main¶
PROIBIDO fazer commits diretamente na branch main.
Antes de qualquer commit, a IA deve verificar:
- Se retornar
main→ PARAR IMEDIATAMENTE - Criar uma feature branch primeiro:
Fluxo obrigatório: 1. Criar branch a partir da main 2. Fazer commits na feature branch 3. Push da feature branch 4. Abrir PR para main 5. Merge via GitHub (nunca local)
Estrutura¶
Tipos¶
| Tipo | Uso | Exemplo |
|---|---|---|
feat |
Nova funcionalidade | feat: add agent knowledge blocks |
fix |
Correção de bug | fix: prevent duplicate webhook processing |
refactor |
Mudança sem alterar comportamento | refactor: extract message processing services |
docs |
Documentação | docs: update message-processing flow |
chore |
Manutenção | chore: upgrade MudBlazor to 8.0 |
test |
Testes | test: add unit tests for LlmResponseParser |
style |
Formatação | style: apply consistent spacing |
perf |
Performance | perf: add index on contact_phone |
Regras do Subject¶
- Tipo em minúsculo —
feat:nãoFeat: - Descrição em inglês
- Verbo imperativo — "add" não "added" ou "adding"
- Sem ponto final
- Máximo 72 caracteres
- Minúscula após o tipo —
feat: addnãofeat: Add
Corpo (Obrigatório para feat/refactor)¶
feat: add structured JSON responses with AI-initiated escalation
- Add response-format.md template enforcing JSON structure
- Create LlmStructuredResponse model for parsed responses
- Implement LlmResponseParser with fallback for non-JSON
- Add shouldEscalate field for human takeover
- Support message fragmentation with 500ms delay
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Regras:
- Linha em branco entre subject e body
- Bullet points com -
- Verbos no imperativo
- Seja específico (nomes de arquivos, componentes)
Quando Corpo é Opcional¶
fix: correct typo in error message
chore: upgrade MudBlazor to 8.0.1
docs: fix broken link in setup.md
Escopo (Opcional)¶
feat(agents): add system prompt optimization
fix(webhook): handle Evolution API timeout
refactor(frontend): extract form validation
Breaking Changes¶
feat!: change webhook payload structure
BREAKING CHANGE: Webhook uses nested key object.
Migration: Update Evolution API to v2.3.7+
Commits com IA¶
| Ferramenta | Rodapé |
|---|---|
| Claude (Opus) | Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
| Claude (Sonnet) | Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> |
| OpenAI Codex | Co-Authored-By: OpenAI Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> |
| GitHub Copilot | Co-Authored-By: GitHub Copilot <noreply@github.com> |
Regras: 1. Revisar mensagem antes de confirmar 2. Ajustar se não reflete a mudança 3. Manter Co-Authored-By para rastreabilidade
Comandos Úteis¶
# Histórico formatado
git log --oneline -20
# Ver último commit
git log -1 --format="%s"
# Corrigir último commit (antes de push)
git commit --amend -m "feat: mensagem corrigida"
# Squash antes de PR
git rebase -i HEAD~3
# Ver diff staged
git diff --staged