@polymorphism-tech/morph-spec 4.3.4 → 4.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.morph/.morphversion +5 -0
- package/.morph/config/agents.json +948 -0
- package/.morph/config/config.json +9 -9
- package/.morph/project/context/README.md +17 -0
- package/.morph/project/context/detection-log.md +16 -0
- package/.morph/project/standards/inferred.md +59 -0
- package/.morph/standards/ai-agents/blazor-ui.md +364 -0
- package/.morph/standards/ai-agents/production.md +415 -0
- package/.morph/standards/ai-agents/setup.md +418 -0
- package/.morph/standards/ai-agents/team-orchestration.md +479 -0
- package/.morph/standards/ai-agents/workflows.md +354 -0
- package/.morph/standards/architecture/ddd/aggregates.md +120 -0
- package/.morph/standards/architecture/ddd/entities.md +99 -0
- package/.morph/standards/architecture/ddd/value-objects.md +124 -0
- package/.morph/standards/backend/api/minimal-api.md +494 -0
- package/.morph/standards/backend/api/rest.md +492 -0
- package/.morph/standards/backend/api/validation.md +88 -0
- package/.morph/standards/backend/authentication/passkeys.md +428 -0
- package/.morph/standards/backend/database/ef-core.md +199 -0
- package/.morph/standards/backend/database/migrations.md +393 -0
- package/.morph/standards/backend/database/postgresql/database.md +352 -0
- package/.morph/standards/backend/database/repository-patterns.md +528 -0
- package/.morph/standards/backend/database/vector-search-rag.md +541 -0
- package/.morph/standards/backend/dotnet/async.md +366 -0
- package/.morph/standards/backend/dotnet/core.md +117 -0
- package/.morph/standards/backend/dotnet/di.md +439 -0
- package/.morph/standards/backend/dotnet/program-cs-checklist.md +92 -0
- package/.morph/standards/backend/integrations/asaas/asaas-api.md +216 -0
- package/.morph/standards/backend/integrations/clerk/clerk-auth.md +290 -0
- package/.morph/standards/backend/integrations/hangfire/hangfire-jobs.md +350 -0
- package/.morph/standards/backend/integrations/resend/resend-email.md +385 -0
- package/.morph/standards/context/analytics.md +96 -0
- package/.morph/standards/context/bundles.md +110 -0
- package/.morph/standards/context/priming.md +78 -0
- package/.morph/standards/core/architecture.md +185 -0
- package/.morph/standards/core/coding.md +214 -0
- package/.morph/standards/core/git-branching-strategy.md +403 -0
- package/.morph/standards/core/git.md +185 -0
- package/.morph/standards/core/testing.md +295 -0
- package/.morph/standards/data/nosql/blob-storage.md +102 -0
- package/.morph/standards/data/nosql/cache/redis.md +97 -0
- package/.morph/standards/data/nosql/cosmos-db.md +118 -0
- package/.morph/standards/data/vector-search/azure-ai-search.md +121 -0
- package/.morph/standards/data/vector-search/rag-chunking.md +104 -0
- package/.morph/standards/frontend/blazor/design-checklist.md +222 -0
- package/.morph/standards/frontend/blazor/fluent-ui-setup.md +595 -0
- package/.morph/standards/frontend/blazor/fluent-ui.md +137 -0
- package/.morph/standards/frontend/blazor/html-conversion.md +184 -0
- package/.morph/standards/frontend/blazor/lifecycle.md +195 -0
- package/.morph/standards/frontend/blazor/pitfalls.md +198 -0
- package/.morph/standards/frontend/blazor/state.md +191 -0
- package/.morph/standards/frontend/design-system/animations.md +151 -0
- package/.morph/standards/frontend/design-system/naming.md +64 -0
- package/.morph/standards/frontend/nextjs/nextjs-patterns.md +198 -0
- package/.morph/standards/infrastructure/azure/azure.md +624 -0
- package/.morph/standards/infrastructure/azure/bicep/bicep-patterns.md +422 -0
- package/.morph/standards/infrastructure/azure/devops/azure-devops-setup.md +516 -0
- package/.morph/standards/infrastructure/azure/devops/local-development.md +520 -0
- package/.morph/standards/infrastructure/azure/services/functions.md +486 -0
- package/.morph/standards/infrastructure/azure/services/service-bus.md +459 -0
- package/.morph/standards/infrastructure/azure/services/storage.md +407 -0
- package/.morph/standards/infrastructure/docker/easypanel-deploy.md +196 -0
- package/.morph/standards/infrastructure/supabase/mcp-setup.md +252 -0
- package/.morph/standards/infrastructure/supabase/supabase-auth.md +176 -0
- package/.morph/standards/infrastructure/supabase/supabase-pgvector.md +169 -0
- package/.morph/standards/infrastructure/supabase/supabase-rls.md +184 -0
- package/.morph/standards/infrastructure/supabase/supabase-storage.md +153 -0
- package/.morph/standards/integration/api/graphql.md +91 -0
- package/.morph/standards/integration/api/grpc.md +114 -0
- package/.morph/standards/integration/api/rest-design.md +95 -0
- package/.morph/standards/integration/event-driven/cqrs.md +101 -0
- package/.morph/standards/integration/event-driven/event-sourcing.md +124 -0
- package/.morph/standards/integration/event-driven/service-bus.md +95 -0
- package/.morph/standards/observability/logging.md +131 -0
- package/.morph/standards/observability/metrics.md +121 -0
- package/.morph/standards/observability/monitoring.md +114 -0
- package/.morph/standards/observability/tracing.md +132 -0
- package/.morph/standards/workflows/parallel-execution.md +112 -0
- package/.morph/standards/workflows/thread-management.md +113 -0
- package/.morph/templates/.idea/morph-templates.xml +92 -0
- package/.morph/templates/.vscode/morph-templates.code-snippets +186 -0
- package/.morph/templates/IDE-SNIPPETS.md +266 -0
- package/.morph/templates/README.md +814 -0
- package/.morph/templates/REGISTRY.json +1677 -0
- package/.morph/templates/code/dotnet/backend/repository.cs +141 -0
- package/.morph/templates/code/dotnet/backend/service.cs +139 -0
- package/.morph/templates/code/dotnet/contracts/Commands.cs +74 -0
- package/.morph/templates/code/dotnet/contracts/Entities.cs +25 -0
- package/.morph/templates/code/dotnet/contracts/Queries.cs +74 -0
- package/.morph/templates/code/dotnet/contracts/README.md +74 -0
- package/.morph/templates/code/dotnet/contracts/api-contracts.cs +173 -0
- package/.morph/templates/code/dotnet/contracts/contracts.cs +217 -0
- package/.morph/templates/code/dotnet/database/migration.cs +83 -0
- package/.morph/templates/code/dotnet/frontend/component.razor +239 -0
- package/.morph/templates/code/dotnet/jobs/agent.cs +163 -0
- package/.morph/templates/code/dotnet/jobs/job.cs +171 -0
- package/.morph/templates/code/dotnet/test.cs +239 -0
- package/.morph/templates/code/sql/rls-policy.sql +57 -0
- package/.morph/templates/code/sql/supabase-migration.sql +100 -0
- package/.morph/templates/code/sql/supabase-migration.template.sql +113 -0
- package/.morph/templates/code/typescript/contracts.ts +168 -0
- package/.morph/templates/context/CONTEXT-FEATURE.md +276 -0
- package/.morph/templates/context/CONTEXT.md +181 -0
- package/.morph/templates/docs/proposal.md +182 -0
- package/.morph/templates/docs/spec.md +149 -0
- package/.morph/templates/examples/design-system-examples.md +357 -0
- package/.morph/templates/examples/spec-examples.md +90 -0
- package/.morph/templates/feature/decisions.md +187 -0
- package/.morph/templates/feature/recap.md +146 -0
- package/.morph/templates/feature/tasks.md +199 -0
- package/.morph/templates/infrastructure/azure/Dockerfile.example +82 -0
- package/.morph/templates/infrastructure/azure/README.md +286 -0
- package/.morph/templates/infrastructure/azure/app-insights.bicep +63 -0
- package/.morph/templates/infrastructure/azure/app-service.bicep +164 -0
- package/.morph/templates/infrastructure/azure/container-app-env.bicep +49 -0
- package/.morph/templates/infrastructure/azure/container-app.bicep +156 -0
- package/.morph/templates/infrastructure/azure/deploy-checklist.md +426 -0
- package/.morph/templates/infrastructure/azure/deploy.ps1 +229 -0
- package/.morph/templates/infrastructure/azure/deploy.sh +208 -0
- package/.morph/templates/infrastructure/azure/key-vault.bicep +91 -0
- package/.morph/templates/infrastructure/azure/main.bicep +189 -0
- package/.morph/templates/infrastructure/azure/parameters.dev.json +29 -0
- package/.morph/templates/infrastructure/azure/parameters.prod.json +29 -0
- package/.morph/templates/infrastructure/azure/parameters.staging.json +29 -0
- package/.morph/templates/infrastructure/azure/sql-database.bicep +103 -0
- package/.morph/templates/infrastructure/azure/storage.bicep +106 -0
- package/.morph/templates/infrastructure/docker/Dockerfile.template +58 -0
- package/.morph/templates/infrastructure/docker/docker-compose.template.yml +67 -0
- package/.morph/templates/infrastructure/docker/dockerfile-api.dockerfile +38 -0
- package/.morph/templates/infrastructure/docker/dockerfile-web.dockerfile +48 -0
- package/.morph/templates/infrastructure/docker/easypanel.template.json +54 -0
- package/.morph/templates/infrastructure/github/README.md +593 -0
- package/.morph/templates/infrastructure/github/actions/azure-auth/action.yml.hbs +22 -0
- package/.morph/templates/infrastructure/github/actions/docker-build-push/action.yml.hbs +45 -0
- package/.morph/templates/infrastructure/github/actions/health-check/action.yml.hbs +27 -0
- package/.morph/templates/infrastructure/github/workflows/deploy-azure-app-service.yml.hbs +61 -0
- package/.morph/templates/infrastructure/github/workflows/deploy-easypanel.yml.hbs +31 -0
- package/.morph/templates/infrastructure/github/workflows/docker-build-push.yml.hbs +59 -0
- package/.morph/templates/infrastructure/github/workflows/dotnet-build.yml.hbs +39 -0
- package/.morph/templates/integrations/asaas-client.cs +387 -0
- package/.morph/templates/integrations/asaas-webhook.cs +351 -0
- package/.morph/templates/integrations/azure-identity-config.cs +288 -0
- package/.morph/templates/integrations/clerk-config.cs +258 -0
- package/.morph/templates/meta-prompts/fusion/fusion-agent.md +76 -0
- package/.morph/templates/meta-prompts/fusion/fusion-aggregator.md +100 -0
- package/.morph/templates/meta-prompts/hops/hop-retry.md +78 -0
- package/.morph/templates/meta-prompts/hops/hop-validation.md +97 -0
- package/.morph/templates/meta-prompts/hops/hop-wrapper.md +36 -0
- package/.morph/templates/meta-prompts/parallel-workers/parallel-coordinator.md +113 -0
- package/.morph/templates/meta-prompts/parallel-workers/parallel-worker.md +80 -0
- package/.morph/templates/meta-prompts/squad-leaders/backend-squad.md +90 -0
- package/.morph/templates/meta-prompts/squad-leaders/frontend-squad.md +126 -0
- package/.morph/templates/meta-prompts/squad-leaders/squad-leader.md +43 -0
- package/.morph/templates/meta-prompts/validators/checkpoint-validator.md +107 -0
- package/.morph/templates/meta-prompts/validators/pre-commit-validator.md +95 -0
- package/.morph/templates/saas/subscription.cs +347 -0
- package/.morph/templates/saas/tenant.cs +338 -0
- package/.morph/templates/state.template.json +17 -0
- package/.morph/templates/ui/FluentDesignTheme.cs +149 -0
- package/.morph/templates/ui/MudTheme.cs +281 -0
- package/.morph/templates/ui/design-system.css +226 -0
- package/bin/morph-spec.js +1 -1
- package/package.json +1 -1
- package/src/commands/project/update.js +185 -46
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
# Git Branching Strategy
|
|
2
|
+
|
|
3
|
+
> **Scope:** universal
|
|
4
|
+
> **Layer:** 0
|
|
5
|
+
> **Keywords:** git, branch, workflow, pr, pull request, merge, staging, production, feature branch
|
|
6
|
+
> **Load When:** always
|
|
7
|
+
|
|
8
|
+
> **Git Flow simplificado para one-person business**
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 🌳 Estrutura de Branches
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
main/master (produção)
|
|
16
|
+
↑
|
|
17
|
+
│ PR (com aprovação)
|
|
18
|
+
│
|
|
19
|
+
staging (homologação)
|
|
20
|
+
↑
|
|
21
|
+
│ PR (automático merge)
|
|
22
|
+
│
|
|
23
|
+
feature/* (desenvolvimento)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### **Branches Principais**
|
|
27
|
+
|
|
28
|
+
| Branch | Propósito | Deploy | Aprovação |
|
|
29
|
+
|--------|-----------|--------|-----------|
|
|
30
|
+
| **`main`** ou **`master`** | Produção | Container Apps (always-on) | ✅ Obrigatória |
|
|
31
|
+
| **`staging`** | Homologação/QA | Container Apps (scale-to-zero) | ❌ Nenhuma |
|
|
32
|
+
|
|
33
|
+
### **Branches Temporárias**
|
|
34
|
+
|
|
35
|
+
| Padrão | Exemplo | Propósito |
|
|
36
|
+
|--------|---------|-----------|
|
|
37
|
+
| `feature/*` | `feature/add-payments` | Nova funcionalidade |
|
|
38
|
+
| `bugfix/*` | `bugfix/fix-login` | Correção de bug |
|
|
39
|
+
| `hotfix/*` | `hotfix/critical-security` | Correção urgente em prod |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 🔄 Workflow Completo
|
|
44
|
+
|
|
45
|
+
### 1. Nova Feature
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Atualizar staging
|
|
49
|
+
git checkout staging
|
|
50
|
+
git pull origin staging
|
|
51
|
+
|
|
52
|
+
# Criar feature branch
|
|
53
|
+
git checkout -b feature/pagamentos-asaas
|
|
54
|
+
|
|
55
|
+
# Desenvolver localmente
|
|
56
|
+
# ... code, test, commit ...
|
|
57
|
+
|
|
58
|
+
# Push
|
|
59
|
+
git push origin feature/pagamentos-asaas
|
|
60
|
+
|
|
61
|
+
# Criar PR para staging
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Azure DevOps**:
|
|
65
|
+
1. **Repos** → **Pull Requests** → **New**
|
|
66
|
+
2. Source: `feature/pagamentos-asaas`
|
|
67
|
+
3. Target: `staging`
|
|
68
|
+
4. Title: "feat: integração com Asaas para pagamentos recorrentes"
|
|
69
|
+
5. Description: Detalhar mudanças
|
|
70
|
+
6. **Create**
|
|
71
|
+
7. **Approve** (você mesmo) e **Complete**
|
|
72
|
+
|
|
73
|
+
**Resultado**: Pipeline staging triggado automaticamente
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### 2. Bug Fix
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Partir de staging
|
|
81
|
+
git checkout staging
|
|
82
|
+
git pull origin staging
|
|
83
|
+
|
|
84
|
+
# Criar bugfix branch
|
|
85
|
+
git checkout -b bugfix/corrigir-calculo-total
|
|
86
|
+
|
|
87
|
+
# Corrigir + testar
|
|
88
|
+
git add .
|
|
89
|
+
git commit -m "fix: corrige cálculo de total no carrinho"
|
|
90
|
+
|
|
91
|
+
# Push e PR para staging
|
|
92
|
+
git push origin bugfix/corrigir-calculo-total
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### 3. Hotfix (Produção)
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Partir de main (produção)
|
|
101
|
+
git checkout main
|
|
102
|
+
git pull origin main
|
|
103
|
+
|
|
104
|
+
# Criar hotfix branch
|
|
105
|
+
git checkout -b hotfix/vulnerabilidade-critica
|
|
106
|
+
|
|
107
|
+
# Corrigir urgentemente
|
|
108
|
+
git add .
|
|
109
|
+
git commit -m "fix: corrige vulnerabilidade SQL injection"
|
|
110
|
+
|
|
111
|
+
# Push
|
|
112
|
+
git push origin hotfix/vulnerabilidade-critica
|
|
113
|
+
|
|
114
|
+
# Criar 2 PRs:
|
|
115
|
+
# 1. hotfix → main (deploy imediato)
|
|
116
|
+
# 2. hotfix → staging (manter ambientes sincronizados)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Atenção**: Hotfix é para emergências! Use com moderação.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### 4. Release (Staging → Produção)
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Quando staging estiver estável e testado
|
|
127
|
+
|
|
128
|
+
# Criar PR no Azure DevOps:
|
|
129
|
+
# Source: staging
|
|
130
|
+
# Target: main
|
|
131
|
+
|
|
132
|
+
# Self-review checklist:
|
|
133
|
+
# - [ ] Funcionalidades testadas em staging
|
|
134
|
+
# - [ ] Performance OK
|
|
135
|
+
# - [ ] Sem erros nos logs
|
|
136
|
+
# - [ ] Migrations aplicadas
|
|
137
|
+
# - [ ] Documentação atualizada
|
|
138
|
+
|
|
139
|
+
# Approve e Complete
|
|
140
|
+
# Pipeline prod triggará
|
|
141
|
+
# ⏸️ Approval gate aparecerá
|
|
142
|
+
# Aprovar após validar deployment summary
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## ⚙️ Configuração Azure DevOps
|
|
148
|
+
|
|
149
|
+
### Branch Policies (Staging)
|
|
150
|
+
|
|
151
|
+
**Repos** → **Branches** → `staging` → **Branch policies**:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
✅ Require a minimum number of reviewers: 0
|
|
155
|
+
(você pode fazer self-merge)
|
|
156
|
+
|
|
157
|
+
✅ Check for linked work items: Recommended
|
|
158
|
+
(boa prática para rastreabilidade)
|
|
159
|
+
|
|
160
|
+
✅ Check for comment resolution: All
|
|
161
|
+
(resolver comentários antes de merge)
|
|
162
|
+
|
|
163
|
+
✅ Build validation:
|
|
164
|
+
- Pipeline: staging-pipeline
|
|
165
|
+
- Trigger: Automatic
|
|
166
|
+
- Policy requirement: Required
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Branch Policies (Main)
|
|
170
|
+
|
|
171
|
+
**Repos** → **Branches** → `main` → **Branch policies**:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
✅ Require a minimum number of reviewers: 0
|
|
175
|
+
(você faz self-review com approval gate no pipeline)
|
|
176
|
+
|
|
177
|
+
✅ Check for linked work items: Required
|
|
178
|
+
(obrigatório para rastreabilidade)
|
|
179
|
+
|
|
180
|
+
✅ Check for comment resolution: All
|
|
181
|
+
|
|
182
|
+
✅ Build validation:
|
|
183
|
+
- Pipeline: prod-pipeline
|
|
184
|
+
- Trigger: Automatic
|
|
185
|
+
- Policy requirement: Required
|
|
186
|
+
|
|
187
|
+
❌ Limit merge types:
|
|
188
|
+
✅ Squash merge only (recomendado)
|
|
189
|
+
(mantém histórico limpo)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 🎯 Boas Práticas
|
|
195
|
+
|
|
196
|
+
### Commits
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Use Conventional Commits
|
|
200
|
+
feat: adiciona integração com Asaas
|
|
201
|
+
fix: corrige cálculo de desconto
|
|
202
|
+
docs: atualiza README com instruções de deploy
|
|
203
|
+
refactor: simplifica lógica de autenticação
|
|
204
|
+
test: adiciona testes para carrinho de compras
|
|
205
|
+
chore: atualiza dependências do projeto
|
|
206
|
+
|
|
207
|
+
# Seja descritivo no body (se necessário)
|
|
208
|
+
git commit -m "feat: integração Asaas" -m "
|
|
209
|
+
- Adiciona AsaasClient para chamadas API
|
|
210
|
+
- Implementa webhook para notificações
|
|
211
|
+
- Cria tabela Subscriptions para assinaturas
|
|
212
|
+
- Adiciona testes de integração
|
|
213
|
+
"
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Feature Branches
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# ✅ Bom
|
|
220
|
+
feature/add-asaas-integration
|
|
221
|
+
feature/user-dashboard
|
|
222
|
+
bugfix/fix-login-redirect
|
|
223
|
+
|
|
224
|
+
# ❌ Ruim
|
|
225
|
+
my-changes
|
|
226
|
+
temp
|
|
227
|
+
test
|
|
228
|
+
wip
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Merge vs Squash vs Rebase
|
|
232
|
+
|
|
233
|
+
**Recomendação para one-person business**: **Squash merge**
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
# Vantagens squash:
|
|
237
|
+
- Histórico limpo em main/staging
|
|
238
|
+
- Cada merge = 1 commit = 1 feature
|
|
239
|
+
- Fácil reverter feature inteira
|
|
240
|
+
- Fácil ler changelog
|
|
241
|
+
|
|
242
|
+
# Configurar no Azure DevOps:
|
|
243
|
+
Branch Policies → Limit merge types → Squash merge only
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## 📊 Visualização do Fluxo
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
┌─────────────────────────────────────────────────────────┐
|
|
252
|
+
│ Developer Local │
|
|
253
|
+
│ │
|
|
254
|
+
│ feature/pagamentos-asaas │
|
|
255
|
+
│ │ │
|
|
256
|
+
│ ├─ commit: adiciona AsaasClient │
|
|
257
|
+
│ ├─ commit: implementa webhook │
|
|
258
|
+
│ └─ commit: adiciona testes │
|
|
259
|
+
└──────────────────────│──────────────────────────────────┘
|
|
260
|
+
│
|
|
261
|
+
│ git push
|
|
262
|
+
│ + PR para staging
|
|
263
|
+
↓
|
|
264
|
+
┌─────────────────────────────────────────────────────────┐
|
|
265
|
+
│ Staging Branch │
|
|
266
|
+
│ │
|
|
267
|
+
│ Squash merge │
|
|
268
|
+
│ └─ feat: integração completa com Asaas │
|
|
269
|
+
│ │
|
|
270
|
+
│ Pipeline staging-pipeline triggado │
|
|
271
|
+
│ └─ Deploy automático para staging │
|
|
272
|
+
└──────────────────────│──────────────────────────────────┘
|
|
273
|
+
│
|
|
274
|
+
│ Testes manuais OK
|
|
275
|
+
│ PR staging → main
|
|
276
|
+
↓
|
|
277
|
+
┌─────────────────────────────────────────────────────────┐
|
|
278
|
+
│ Main Branch (Produção) │
|
|
279
|
+
│ │
|
|
280
|
+
│ Squash merge │
|
|
281
|
+
│ └─ feat: integração completa com Asaas │
|
|
282
|
+
│ │
|
|
283
|
+
│ Pipeline prod-pipeline triggado │
|
|
284
|
+
│ ├─ Build & Security Scan │
|
|
285
|
+
│ ├─ ⏸️ Approval gate (você aprova) │
|
|
286
|
+
│ └─ Deploy para produção │
|
|
287
|
+
└─────────────────────────────────────────────────────────┘
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## 🆘 Cenários Comuns
|
|
293
|
+
|
|
294
|
+
### Conflito de Merge
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Atualizar feature branch com staging
|
|
298
|
+
git checkout feature/minha-feature
|
|
299
|
+
git fetch origin
|
|
300
|
+
git merge origin/staging
|
|
301
|
+
|
|
302
|
+
# Resolver conflitos manualmente
|
|
303
|
+
# Editar arquivos, escolher versão correta
|
|
304
|
+
|
|
305
|
+
git add .
|
|
306
|
+
git commit -m "merge: resolve conflitos com staging"
|
|
307
|
+
git push origin feature/minha-feature
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Reverter um Merge
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
# Se merge em staging deu problema
|
|
314
|
+
git checkout staging
|
|
315
|
+
git revert -m 1 <commit-hash-do-merge>
|
|
316
|
+
git push origin staging
|
|
317
|
+
|
|
318
|
+
# Pipeline triggará e deployará versão sem a feature
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Sincronizar Branch Desatualizada
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
# Sua feature ficou muito desatualizada
|
|
325
|
+
git checkout feature/antiga
|
|
326
|
+
git fetch origin
|
|
327
|
+
git merge origin/staging
|
|
328
|
+
|
|
329
|
+
# Ou, se preferir histórico limpo (rebase)
|
|
330
|
+
git rebase origin/staging
|
|
331
|
+
|
|
332
|
+
# Se houver conflitos, resolve e continua
|
|
333
|
+
git rebase --continue
|
|
334
|
+
|
|
335
|
+
git push origin feature/antiga --force-with-lease
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Deletar Branch Remota
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
# Após merge, deletar feature branch
|
|
342
|
+
git push origin --delete feature/minha-feature
|
|
343
|
+
|
|
344
|
+
# Deletar local também
|
|
345
|
+
git branch -d feature/minha-feature
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## 📅 Cadência Recomendada
|
|
351
|
+
|
|
352
|
+
### Para One-Person Business
|
|
353
|
+
|
|
354
|
+
| Atividade | Frequência | Descrição |
|
|
355
|
+
|-----------|------------|-----------|
|
|
356
|
+
| **Commits** | Várias vezes/dia | Commits pequenos e frequentes |
|
|
357
|
+
| **Push** | 1-2x/dia | Push ao final do dia ou feature completa |
|
|
358
|
+
| **PR → Staging** | 1-3x/semana | Quando feature está funcional |
|
|
359
|
+
| **Deploy Staging** | Automático | Após merge no staging |
|
|
360
|
+
| **PR → Prod** | 1x/semana ou quinzenal | Quando staging está estável |
|
|
361
|
+
| **Deploy Prod** | Conforme necessário | Após aprovação manual |
|
|
362
|
+
|
|
363
|
+
**Dica**: Não acumule muitas features antes de fazer release. Releases pequenos e frequentes são mais seguros.
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## ✅ Checklist de PR
|
|
368
|
+
|
|
369
|
+
### Antes de Criar PR
|
|
370
|
+
|
|
371
|
+
- [ ] Código testado localmente
|
|
372
|
+
- [ ] Unit tests passando (`dotnet test`)
|
|
373
|
+
- [ ] Sem warnings de compilação
|
|
374
|
+
- [ ] Código formatado/lint OK
|
|
375
|
+
- [ ] Commits com mensagens descritivas
|
|
376
|
+
- [ ] Branch atualizada com target (staging ou main)
|
|
377
|
+
|
|
378
|
+
### Ao Criar PR
|
|
379
|
+
|
|
380
|
+
- [ ] Título descritivo (feat/fix/docs/etc)
|
|
381
|
+
- [ ] Descrição clara do que mudou
|
|
382
|
+
- [ ] Linkar work item se houver
|
|
383
|
+
- [ ] Adicionar screenshots se for UI
|
|
384
|
+
|
|
385
|
+
### Antes de Aprovar (Self-Review)
|
|
386
|
+
|
|
387
|
+
- [ ] Revisar diff completo
|
|
388
|
+
- [ ] Verificar se não commitou secrets/senhas
|
|
389
|
+
- [ ] Verificar se não tem console.log/debug temporário
|
|
390
|
+
- [ ] Pipeline de build passou
|
|
391
|
+
- [ ] Sem conflitos
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## 📚 Referências
|
|
396
|
+
|
|
397
|
+
- [Git Flow](https://nvie.com/posts/a-successful-git-branching-model/)
|
|
398
|
+
- [Conventional Commits](https://www.conventionalcommits.org/)
|
|
399
|
+
- [Azure Repos Branch Policies](https://learn.microsoft.com/azure/devops/repos/git/branch-policies)
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
*MORPH-SPEC by Polymorphism Tech*
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Git Standards
|
|
2
|
+
|
|
3
|
+
> **Scope:** universal
|
|
4
|
+
> **Layer:** 0 (always load)
|
|
5
|
+
> **Keywords:** git, commit, branch, version control, collaboration
|
|
6
|
+
> **Load When:** always
|
|
7
|
+
|
|
8
|
+
Version control and collaboration standards for MORPH-SPEC projects
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Commit Messages
|
|
13
|
+
|
|
14
|
+
### Format
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
<type>(<scope>): <subject>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
|
|
21
|
+
<footer>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Types
|
|
25
|
+
|
|
26
|
+
- `feat`: New feature
|
|
27
|
+
- `fix`: Bug fix
|
|
28
|
+
- `docs`: Documentation only
|
|
29
|
+
- `style`: Code style (formatting, no logic change)
|
|
30
|
+
- `refactor`: Code refactoring (no feature/fix)
|
|
31
|
+
- `test`: Adding/updating tests
|
|
32
|
+
- `chore`: Build/tool/dependency updates
|
|
33
|
+
- `perf`: Performance improvement
|
|
34
|
+
|
|
35
|
+
### Examples
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
feat(auth): add JWT refresh token rotation
|
|
39
|
+
|
|
40
|
+
Implemented automatic refresh token rotation on every token refresh
|
|
41
|
+
to improve security. Old tokens are invalidated immediately.
|
|
42
|
+
|
|
43
|
+
Closes #123
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
fix(api): prevent SQL injection in search endpoint
|
|
48
|
+
|
|
49
|
+
Sanitized user input before database query execution.
|
|
50
|
+
Added parameterized queries for all search operations.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Branch Naming
|
|
56
|
+
|
|
57
|
+
### Format
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
<type>/<issue-number>-<short-description>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Types
|
|
64
|
+
|
|
65
|
+
- `feature/` - New features
|
|
66
|
+
- `bugfix/` - Bug fixes
|
|
67
|
+
- `hotfix/` - Urgent production fixes
|
|
68
|
+
- `refactor/` - Code refactoring
|
|
69
|
+
- `docs/` - Documentation updates
|
|
70
|
+
|
|
71
|
+
### Examples
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
feature/123-user-authentication
|
|
75
|
+
bugfix/456-login-redirect
|
|
76
|
+
hotfix/789-payment-gateway-timeout
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Workflow
|
|
82
|
+
|
|
83
|
+
### Feature Development
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# 1. Create branch from main
|
|
87
|
+
git checkout main
|
|
88
|
+
git pull origin main
|
|
89
|
+
git checkout -b feature/123-user-auth
|
|
90
|
+
|
|
91
|
+
# 2. Make changes, commit often
|
|
92
|
+
git add .
|
|
93
|
+
git commit -m "feat(auth): add User entity"
|
|
94
|
+
|
|
95
|
+
# 3. Push to remote
|
|
96
|
+
git push -u origin feature/123-user-auth
|
|
97
|
+
|
|
98
|
+
# 4. Create pull request
|
|
99
|
+
# 5. After approval, squash merge to main
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Pull Request Standards
|
|
103
|
+
|
|
104
|
+
- **Title**: Same format as commit messages
|
|
105
|
+
- **Description**:
|
|
106
|
+
- Summary of changes
|
|
107
|
+
- Related issues
|
|
108
|
+
- Testing done
|
|
109
|
+
- Breaking changes (if any)
|
|
110
|
+
- **Reviewers**: Minimum 1 approval required
|
|
111
|
+
- **CI/CD**: All checks must pass
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Best Practices
|
|
116
|
+
|
|
117
|
+
### DO
|
|
118
|
+
|
|
119
|
+
✅ Commit early and often (small, focused commits)
|
|
120
|
+
✅ Write descriptive commit messages
|
|
121
|
+
✅ Pull before push to avoid conflicts
|
|
122
|
+
✅ Use `.gitignore` to exclude build artifacts, secrets
|
|
123
|
+
✅ Tag releases (`v1.0.0`, `v1.1.0`)
|
|
124
|
+
|
|
125
|
+
### DON'T
|
|
126
|
+
|
|
127
|
+
❌ Commit secrets (API keys, passwords)
|
|
128
|
+
❌ Commit large binary files
|
|
129
|
+
❌ Force push to shared branches
|
|
130
|
+
❌ Commit directly to `main` (use PRs)
|
|
131
|
+
❌ Use generic messages ("fix", "update")
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## .gitignore Templates
|
|
136
|
+
|
|
137
|
+
### .NET Projects
|
|
138
|
+
|
|
139
|
+
```gitignore
|
|
140
|
+
# Build results
|
|
141
|
+
bin/
|
|
142
|
+
obj/
|
|
143
|
+
*.user
|
|
144
|
+
*.suo
|
|
145
|
+
|
|
146
|
+
# NuGet packages
|
|
147
|
+
*.nupkg
|
|
148
|
+
packages/
|
|
149
|
+
|
|
150
|
+
# Environment files
|
|
151
|
+
.env
|
|
152
|
+
.env.local
|
|
153
|
+
appsettings.Development.json
|
|
154
|
+
|
|
155
|
+
# IDE
|
|
156
|
+
.vs/
|
|
157
|
+
.vscode/
|
|
158
|
+
.idea/
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Node.js Projects
|
|
162
|
+
|
|
163
|
+
```gitignore
|
|
164
|
+
# Dependencies
|
|
165
|
+
node_modules/
|
|
166
|
+
npm-debug.log
|
|
167
|
+
yarn-error.log
|
|
168
|
+
|
|
169
|
+
# Build output
|
|
170
|
+
dist/
|
|
171
|
+
.next/
|
|
172
|
+
out/
|
|
173
|
+
|
|
174
|
+
# Environment
|
|
175
|
+
.env
|
|
176
|
+
.env.local
|
|
177
|
+
|
|
178
|
+
# IDE
|
|
179
|
+
.vscode/
|
|
180
|
+
.idea/
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
*MORPH-SPEC by Polymorphism Tech*
|