Pular para conteúdo

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:

git branch --show-current

  • Se retornar mainPARAR IMEDIATAMENTE
  • Criar uma feature branch primeiro:
    git checkout -b feat/nome-da-feature
    

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

<tipo>: <descrição curta>

<corpo com detalhes>

Co-Authored-By: <autor>

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

  1. Tipo em minúsculofeat: não Feat:
  2. Descrição em inglês
  3. Verbo imperativo — "add" não "added" ou "adding"
  4. Sem ponto final
  5. Máximo 72 caracteres
  6. Minúscula após o tipo — feat: add não feat: 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

Referências