sinapse-ai 9.4.0 → 9.5.0
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/.claude/CLAUDE.md +10 -4
- package/.claude/hooks/enforce-architecture-first.py +197 -197
- package/.claude/hooks/enforce-git-push-authority.sh +25 -4
- package/.claude/hooks/mind-clone-governance.py +193 -193
- package/.claude/hooks/read-protection.py +152 -152
- package/.claude/hooks/sql-governance.py +183 -183
- package/.claude/hooks/verify-packages.cjs +83 -0
- package/.claude/hooks/write-path-validation.py +195 -195
- package/.claude/rules/hook-governance.md +1 -0
- package/.claude/rules/mandatory-delegation.md +24 -0
- package/.claude/rules/project-intelligence.md +63 -0
- package/.claude/rules/response-format.md +4 -0
- package/.claude/rules/safe-collaboration.md +4 -2
- package/.claude/rules/security-data-protection.md +18 -0
- package/.claude/rules/squad-awareness.md +93 -67
- package/.claude/rules/token-economy.md +148 -0
- package/.codex/agents/analyst.md +90 -0
- package/.codex/agents/architect.md +78 -0
- package/.codex/agents/data-engineer.md +38 -0
- package/.codex/agents/developer.md +97 -0
- package/.codex/agents/devops.md +121 -0
- package/.codex/agents/product-lead.md +27 -0
- package/.codex/agents/project-lead.md +28 -0
- package/.codex/agents/quality-gate.md +89 -0
- package/.codex/agents/sprint-lead.md +28 -0
- package/.codex/agents/squad-creator.md +58 -0
- package/.codex/agents/ux-design-expert.md +28 -0
- package/.sinapse-ai/core/code-intel/registry-syncer.js +56 -3
- package/.sinapse-ai/core/doctor/checks/agent-memory.js +5 -1
- package/.sinapse-ai/core/doctor/checks/claude-md.js +4 -1
- package/.sinapse-ai/core/doctor/checks/code-intel.js +5 -1
- package/.sinapse-ai/core/doctor/checks/commands-count.js +4 -1
- package/.sinapse-ai/core/doctor/checks/constitution-consistency.js +4 -1
- package/.sinapse-ai/core/doctor/checks/core-config.js +4 -1
- package/.sinapse-ai/core/doctor/checks/entity-registry.js +6 -1
- package/.sinapse-ai/core/doctor/checks/git-hooks.js +5 -1
- package/.sinapse-ai/core/doctor/checks/graph-dashboard.js +4 -1
- package/.sinapse-ai/core/doctor/checks/hooks-claude-count.js +5 -1
- package/.sinapse-ai/core/doctor/checks/ide-sync.js +4 -1
- package/.sinapse-ai/core/doctor/checks/node-version.js +4 -1
- package/.sinapse-ai/core/doctor/checks/npm-packages.js +4 -1
- package/.sinapse-ai/core/doctor/checks/rules-files.js +4 -1
- package/.sinapse-ai/core/doctor/checks/settings-json.js +4 -1
- package/.sinapse-ai/core/doctor/checks/skills-count.js +4 -1
- package/.sinapse-ai/core/doctor/index.js +157 -50
- package/.sinapse-ai/core/ids/registry-updater.js +6 -1
- package/.sinapse-ai/core/logger/index.js +319 -0
- package/.sinapse-ai/core/orchestration/terminal-spawner.js +2 -2
- package/.sinapse-ai/core/telemetry/index.js +247 -0
- package/.sinapse-ai/data/entity-registry.yaml +1384 -944
- package/.sinapse-ai/development/agents/architect.md +5 -0
- package/.sinapse-ai/development/agents/data-engineer.md +38 -0
- package/.sinapse-ai/development/agents/developer.md +28 -0
- package/.sinapse-ai/development/agents/devops.md +4 -0
- package/.sinapse-ai/development/agents/product-lead.md +27 -0
- package/.sinapse-ai/development/agents/project-lead.md +28 -0
- package/.sinapse-ai/development/agents/quality-gate.md +4 -0
- package/.sinapse-ai/development/agents/sprint-lead/MEMORY.md +8 -0
- package/.sinapse-ai/development/agents/sprint-lead.md +28 -0
- package/.sinapse-ai/development/agents/squad-creator.md +58 -0
- package/.sinapse-ai/development/agents/ux-design-expert.md +28 -0
- package/.sinapse-ai/development/knowledge-base/agent-communication-protocol.md +127 -0
- package/.sinapse-ai/development/knowledge-base/database-scaling-patterns.md +374 -0
- package/.sinapse-ai/development/knowledge-base/environment-deployment-patterns.md +353 -0
- package/.sinapse-ai/development/knowledge-base/gotchas-patterns.md +224 -0
- package/.sinapse-ai/development/knowledge-base/infrastructure-decision-framework.md +221 -0
- package/.sinapse-ai/development/knowledge-base/security-pre-deploy-checklist.md +410 -0
- package/.sinapse-ai/development/knowledge-base/software-architecture-patterns.md +299 -0
- package/.sinapse-ai/development/knowledge-base/token-economy-guide.md +198 -0
- package/.sinapse-ai/development/scripts/populate-entity-registry.js +5 -1
- package/.sinapse-ai/development/skills/captcha-handler.md +82 -0
- package/.sinapse-ai/development/skills/chrome-brain.md +81 -0
- package/.sinapse-ai/development/skills/deploy-readiness.md +93 -0
- package/.sinapse-ai/development/skills/model-router.md +92 -0
- package/.sinapse-ai/development/skills/sinapse-methodology.md +175 -0
- package/.sinapse-ai/development/skills/story-fast-track.md +71 -0
- package/.sinapse-ai/development/tasks/dev-develop-story.md +10 -0
- package/.sinapse-ai/development/tasks/environment-promotion-pipeline.md +582 -0
- package/.sinapse-ai/development/tasks/generate-agent-handoff.md +223 -0
- package/.sinapse-ai/development/tasks/infrastructure-assessment.md +432 -0
- package/.sinapse-ai/development/tasks/load-testing-setup.md +611 -0
- package/.sinapse-ai/development/tasks/observability-blueprint.md +562 -0
- package/.sinapse-ai/development/templates/legal/breach-notification-tmpl.md +113 -0
- package/.sinapse-ai/development/templates/legal/privacy-policy-tmpl.md +93 -0
- package/.sinapse-ai/development/templates/legal/terms-of-service-tmpl.md +85 -0
- package/.sinapse-ai/development/templates/service-template/README.md.hbs +159 -159
- package/.sinapse-ai/development/templates/service-template/__tests__/index.test.ts.hbs +238 -238
- package/.sinapse-ai/development/templates/service-template/client.ts.hbs +404 -404
- package/.sinapse-ai/development/templates/service-template/errors.ts.hbs +183 -183
- package/.sinapse-ai/development/templates/service-template/index.ts.hbs +121 -121
- package/.sinapse-ai/development/templates/service-template/package.json.hbs +88 -88
- package/.sinapse-ai/development/templates/service-template/types.ts.hbs +146 -146
- package/.sinapse-ai/development/templates/squad-template/LICENSE +22 -22
- package/.sinapse-ai/development/workflows/story-development-cycle.yaml +40 -1
- package/.sinapse-ai/hooks/ids-post-commit.js +22 -0
- package/.sinapse-ai/infrastructure/contracts/compatibility/README.md +42 -0
- package/.sinapse-ai/infrastructure/contracts/compatibility/sinapse-current.yaml +35 -0
- package/.sinapse-ai/infrastructure/scripts/llm-routing/templates/claude-free-tracked.cmd +127 -127
- package/.sinapse-ai/infrastructure/scripts/llm-routing/templates/deepseek-proxy.cmd +71 -71
- package/.sinapse-ai/infrastructure/scripts/llm-routing/templates/deepseek-usage.cmd +51 -51
- package/.sinapse-ai/infrastructure/scripts/pr-review-ai.js +16 -13
- package/.sinapse-ai/infrastructure/scripts/setup-project-infra.js +128 -0
- package/.sinapse-ai/infrastructure/scripts/test-discovery.js +8 -3
- package/.sinapse-ai/infrastructure/scripts/validate-manifest-parity.js +380 -0
- package/.sinapse-ai/infrastructure/scripts/validate-parity.js +76 -25
- package/.sinapse-ai/infrastructure/templates/coderabbit.yaml.template +280 -280
- package/.sinapse-ai/infrastructure/templates/config/env.example +16 -0
- package/.sinapse-ai/infrastructure/templates/config/gitignore-additions.tmpl +59 -0
- package/.sinapse-ai/infrastructure/templates/github/CODEOWNERS.template +12 -0
- package/.sinapse-ai/infrastructure/templates/github/PULL_REQUEST_TEMPLATE.md +29 -0
- package/.sinapse-ai/infrastructure/templates/github/ci-template.yml +77 -0
- package/.sinapse-ai/infrastructure/templates/github/issue-templates/bug_report.md +34 -0
- package/.sinapse-ai/infrastructure/templates/github/issue-templates/feature_request.md +19 -0
- package/.sinapse-ai/infrastructure/templates/github-workflows/ci.yml.template +170 -170
- package/.sinapse-ai/infrastructure/templates/github-workflows/pr-automation.yml.template +331 -331
- package/.sinapse-ai/infrastructure/templates/github-workflows/release.yml.template +197 -197
- package/.sinapse-ai/infrastructure/templates/gitignore/gitignore-brownfield-merge.tmpl +19 -19
- package/.sinapse-ai/infrastructure/templates/gitignore/gitignore-node.tmpl +86 -86
- package/.sinapse-ai/infrastructure/templates/gitignore/gitignore-python.tmpl +146 -146
- package/.sinapse-ai/infrastructure/templates/gitignore/gitignore-sinapse-base.tmpl +64 -64
- package/.sinapse-ai/infrastructure/templates/sinapse-sync.yaml.template +183 -183
- package/.sinapse-ai/install-manifest.yaml +275 -140
- package/.sinapse-ai/local-config.yaml.template +65 -65
- package/.sinapse-ai/monitor/hooks/lib/__init__.py +2 -2
- package/.sinapse-ai/monitor/hooks/lib/enrich.py +59 -59
- package/.sinapse-ai/monitor/hooks/lib/send_event.py +48 -48
- package/.sinapse-ai/monitor/hooks/notification.py +30 -30
- package/.sinapse-ai/monitor/hooks/post_tool_use.py +46 -46
- package/.sinapse-ai/monitor/hooks/pre_compact.py +30 -30
- package/.sinapse-ai/monitor/hooks/pre_tool_use.py +41 -41
- package/.sinapse-ai/monitor/hooks/stop.py +30 -30
- package/.sinapse-ai/monitor/hooks/subagent_stop.py +30 -30
- package/.sinapse-ai/monitor/hooks/user_prompt_submit.py +39 -39
- package/.sinapse-ai/product/templates/adr.hbs +126 -126
- package/.sinapse-ai/product/templates/dbdr.hbs +242 -242
- package/.sinapse-ai/product/templates/epic.hbs +213 -213
- package/.sinapse-ai/product/templates/pmdr.hbs +187 -187
- package/.sinapse-ai/product/templates/prd-v2.0.hbs +217 -217
- package/.sinapse-ai/product/templates/prd.hbs +202 -202
- package/.sinapse-ai/product/templates/story-tmpl.yaml +59 -0
- package/.sinapse-ai/product/templates/story.hbs +264 -264
- package/.sinapse-ai/product/templates/task.hbs +171 -171
- package/.sinapse-ai/product/templates/tmpl-comment-on-examples.sql +159 -159
- package/.sinapse-ai/product/templates/tmpl-migration-script.sql +92 -92
- package/.sinapse-ai/product/templates/tmpl-rls-granular-policies.sql +105 -105
- package/.sinapse-ai/product/templates/tmpl-rls-kiss-policy.sql +11 -11
- package/.sinapse-ai/product/templates/tmpl-rls-roles.sql +136 -136
- package/.sinapse-ai/product/templates/tmpl-rls-simple.sql +78 -78
- package/.sinapse-ai/product/templates/tmpl-rls-tenant.sql +153 -153
- package/.sinapse-ai/product/templates/tmpl-rollback-script.sql +78 -78
- package/.sinapse-ai/product/templates/tmpl-seed-data.sql +141 -141
- package/.sinapse-ai/product/templates/tmpl-smoke-test.sql +17 -17
- package/.sinapse-ai/product/templates/tmpl-staging-copy-merge.sql +140 -140
- package/.sinapse-ai/product/templates/tmpl-stored-proc.sql +141 -141
- package/.sinapse-ai/product/templates/tmpl-trigger.sql +153 -153
- package/.sinapse-ai/product/templates/tmpl-view-materialized.sql +134 -134
- package/.sinapse-ai/product/templates/tmpl-view.sql +178 -178
- package/.sinapse-ai/scripts/diagnostics/health-dashboard/package-lock.json +427 -355
- package/LICENSE +34 -34
- package/README.en.md +167 -20
- package/README.md +190 -22
- package/bin/cli.js +510 -196
- package/bin/postinstall.js +564 -0
- package/bin/sinapse-cli +283 -283
- package/bin/sinapse-graph.js +9 -0
- package/bin/sinapse-init.js +36 -4
- package/bin/sinapse-minimal.js +20 -9
- package/bin/sinapse.js +202 -122
- package/bin/utils/deprecation-warning.js +46 -0
- package/bin/utils/pre-push-safety.js +14 -0
- package/docs/TELEMETRY.md +131 -0
- package/docs/chrome-brain-upgrade-plan.md +624 -0
- package/docs/framework/orqx-plan.md +1 -1
- package/docs/installation/chrome-brain.md +17 -7
- package/docs/mega-upgrade-orchestration-plan.md +71 -0
- package/docs/pt/contributing.md +20 -0
- package/docs/research-synthesis-for-upgrade.md +511 -0
- package/docs/security-audit-report.md +306 -0
- package/package.json +20 -8
- package/packages/installer/src/config/configure-environment.js +19 -44
- package/packages/installer/src/detection/detect-project-type.js +181 -63
- package/packages/installer/src/installer/manifest-signature.js +32 -17
- package/packages/installer/src/wizard/i18n.js +12 -0
- package/packages/installer/src/wizard/ide-config-generator.js +8 -39
- package/packages/installer/src/wizard/index.js +119 -14
- package/packages/installer/src/wizard/questions.js +2 -3
- package/packages/installer/tests/integration/environment-configuration.test.js +7 -5
- package/packages/installer/tests/unit/detection/detect-project-type.test.js +138 -1
- package/packages/installer/tests/unit/doctor/doctor-orchestrator.test.js +3 -3
- package/packages/sinapse-install/bin/edmcp.js +0 -0
- package/packages/sinapse-install/bin/sinapse-install.js +0 -0
- package/packages/sinapse-pro-cli/bin/sinapse-pro.js +0 -0
- package/scripts/check-markdown-links.py +353 -353
- package/scripts/coverage-report-summary.js +169 -0
- package/scripts/generate-install-manifest.js +6 -2
- package/scripts/release-readiness.js +169 -0
- package/scripts/test-install-matrix-local.sh +153 -0
- package/scripts/validate-install-docs.js +394 -0
- package/scripts/validate-no-external-refs.js +376 -0
- package/scripts/validate-squad-orqx.js +302 -0
- package/scripts/validate-story-meta.js +263 -0
- package/squads/claude-code-mastery/CHANGELOG.md +1 -1
- package/squads/claude-code-mastery/README.md +2 -2
- package/squads/claude-code-mastery/squad.yaml +1 -1
- package/squads/squad-artdir/README.md +90 -0
- package/squads/squad-artdir/agents/accessibility-guardian.md +184 -0
- package/squads/squad-artdir/agents/artdir-orqx.md +145 -0
- package/squads/squad-artdir/agents/color-psychologist.md +166 -0
- package/squads/squad-artdir/agents/cro-persuasion.md +161 -0
- package/squads/squad-artdir/agents/design-system-architect.md +100 -0
- package/squads/squad-artdir/agents/ia-architect.md +169 -0
- package/squads/squad-artdir/agents/interaction-designer.md +162 -0
- package/squads/squad-artdir/agents/layout-engineer.md +163 -0
- package/squads/squad-artdir/agents/motion-architect.md +185 -0
- package/squads/squad-artdir/agents/platform-aesthetic-director.md +84 -0
- package/squads/squad-artdir/agents/premium-packaging-strategist.md +107 -0
- package/squads/squad-artdir/agents/product-surface-director.md +86 -0
- package/squads/squad-artdir/agents/type-systemist.md +138 -0
- package/squads/squad-artdir/agents/visual-strategist.md +127 -0
- package/squads/squad-artdir/checklists/seven-pillars-validation-checklist.md +172 -0
- package/squads/squad-artdir/knowledge-base/case-nyo-ia-reference.md +289 -0
- package/squads/squad-artdir/knowledge-base/deliverables-templates.md +457 -0
- package/squads/squad-artdir/knowledge-base/motion-technique-catalog.md +247 -0
- package/squads/squad-artdir/knowledge-base/premium-packaging-principles.md +133 -0
- package/squads/squad-artdir/knowledge-base/psychological-toolkit.md +229 -0
- package/squads/squad-artdir/knowledge-base/saas-art-direction-canon.md +242 -0
- package/squads/squad-artdir/knowledge-base/seven-pillars-framework.md +289 -0
- package/squads/squad-artdir/knowledge-base/ten-pillars-framework.md +221 -0
- package/squads/squad-artdir/package.json +20 -0
- package/squads/squad-artdir/squad.yaml +271 -0
- package/squads/squad-artdir/tasks/audit-conversion.md +97 -0
- package/squads/squad-artdir/tasks/audit-drift-multi-surface.md +55 -0
- package/squads/squad-artdir/tasks/consult-saas-canon.md +54 -0
- package/squads/squad-artdir/tasks/create-art-direction-brief.md +110 -0
- package/squads/squad-artdir/tasks/create-premium-packaging-brief.md +61 -0
- package/squads/squad-artdir/tasks/create-wireflow.md +84 -0
- package/squads/squad-artdir/tasks/design-color-system.md +81 -0
- package/squads/squad-artdir/tasks/design-product-surface.md +60 -0
- package/squads/squad-artdir/tasks/design-token-system.md +58 -0
- package/squads/squad-artdir/tasks/diagnose-visual-language.md +92 -0
- package/squads/squad-artdir/tasks/first-5-minutes-choreography.md +65 -0
- package/squads/squad-artdir/tasks/specify-motion-system.md +84 -0
- package/squads/squad-artdir/tasks/validate-against-pillars.md +143 -0
- package/squads/squad-artdir/templates/art-direction-brief-template.md +215 -0
- package/squads/squad-artdir/workflows/conversion-audit-cycle.yaml +78 -0
- package/squads/squad-artdir/workflows/full-art-direction-cycle.yaml +98 -0
- package/squads/squad-artdir/workflows/saas-platform-art-direction-cycle.yaml +174 -0
- package/squads/squad-brand/knowledge-base/ai-visual-generation-canon.md +234 -0
- package/squads/squad-brand/squad.yaml +20 -6
- package/squads/squad-claude/knowledge-base/context-window-optimization.md +1 -1
- package/squads/squad-claude/knowledge-base/swarm-orchestration-patterns.md +2 -2
- package/squads/squad-content/knowledge-base/ai-native-content-loop.md +220 -0
- package/squads/squad-content/knowledge-base/signal-intelligence-v2.md +234 -0
- package/squads/squad-content/knowledge-base/task-ownership-map.md +235 -0
- package/squads/squad-content/squad.yaml +187 -27
- package/squads/squad-copy/knowledge-base/ai-copy-human-loop-canon.md +235 -0
- package/squads/squad-copy/squad.yaml +19 -4
- package/squads/squad-design/knowledge-base/cross-surface-token-canon.md +209 -0
- package/squads/squad-design/squad.yaml +19 -4
- package/.sinapse-ai/core/registry/service-registry.json +0 -6346
- package/.sinapse-ai/data/registry-update-log.jsonl +0 -1323
- package/.sinapse-ai/manifests/agents.csv +0 -29
- package/.sinapse-ai/manifests/tasks.csv +0 -204
- package/.sinapse-ai/manifests/workers.csv +0 -196
- package/squads/squad-growth/tasks/calculate-sample-size.md +0 -121
- package/squads/squad-paidmedia/tasks/calculate-sample-size.md +0 -57
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
# Environment & Deployment Patterns
|
|
2
|
+
|
|
3
|
+
> **Agente(s):** @devops (Pipeline)
|
|
4
|
+
> **Fonte:** environment-secrets-management.md, gitflow-branching-at-scale.md
|
|
5
|
+
> **Uso:** Consultar ao configurar ambientes, secrets, CI/CD e branching strategy para projetos SINAPSE
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Tiers de Ambientes Padrao
|
|
10
|
+
|
|
11
|
+
### Para Startups (1-10 devs) -- 3 ambientes
|
|
12
|
+
|
|
13
|
+
| Ambiente | Branch | Vercel | Supabase | Dados |
|
|
14
|
+
|----------|--------|--------|----------|-------|
|
|
15
|
+
| Local | qualquer | `vercel dev` | Supabase CLI (local) | Seed/mock |
|
|
16
|
+
| Preview | PR branches | Auto (por PR) | Projeto de staging | Sinteticos |
|
|
17
|
+
| Production | `main` | Production deploy | Projeto de producao | Reais |
|
|
18
|
+
|
|
19
|
+
### Para Scale-ups (10-50 devs) -- 4 ambientes
|
|
20
|
+
|
|
21
|
+
| Ambiente | Branch | Vercel | Supabase | Dados |
|
|
22
|
+
|----------|--------|--------|----------|-------|
|
|
23
|
+
| Local | qualquer | `vercel dev` | CLI local | Seed/mock |
|
|
24
|
+
| Preview | PR branches | Preview deploy | Staging project | Sinteticos |
|
|
25
|
+
| Staging | `staging` | Staging deploy | Staging project | Anonimizados |
|
|
26
|
+
| Production | `main` | Production deploy | Prod project | Reais |
|
|
27
|
+
|
|
28
|
+
### Regras de Paridade (12-Factor)
|
|
29
|
+
|
|
30
|
+
1. Mesma versao do PostgreSQL em TODOS os ambientes
|
|
31
|
+
2. Mesma versao do runtime (Node.js, Deno)
|
|
32
|
+
3. Mesmos backing services (Redis, S3)
|
|
33
|
+
4. Mesma estrutura de env vars (nomes identicos, valores diferentes)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2. Env Var Naming Convention
|
|
38
|
+
|
|
39
|
+
### Formato: `PREFIX_SERVICE_KEY` (SCREAMING_SNAKE_CASE)
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Database
|
|
43
|
+
DATABASE_URL=<connection-string>
|
|
44
|
+
DATABASE_POOL_SIZE=20
|
|
45
|
+
DATABASE_SSL_MODE=require
|
|
46
|
+
|
|
47
|
+
# APIs externas
|
|
48
|
+
STRIPE_SECRET_KEY=<sk_live_or_test>
|
|
49
|
+
STRIPE_WEBHOOK_SECRET=<whsec_...>
|
|
50
|
+
SENDGRID_API_KEY=<SG.xxx>
|
|
51
|
+
|
|
52
|
+
# Auth
|
|
53
|
+
AUTH_JWT_SECRET=<min-32-chars>
|
|
54
|
+
AUTH_JWT_EXPIRY=3600
|
|
55
|
+
|
|
56
|
+
# Feature toggles
|
|
57
|
+
FEATURE_NEW_CHECKOUT=true
|
|
58
|
+
FEATURE_DARK_MODE=false
|
|
59
|
+
|
|
60
|
+
# Infraestrutura
|
|
61
|
+
REDIS_URL=<redis-connection-string>
|
|
62
|
+
S3_BUCKET_NAME=my-app-uploads
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Regras de Nomenclatura
|
|
66
|
+
|
|
67
|
+
| Regra | Correto | Errado |
|
|
68
|
+
|-------|---------|--------|
|
|
69
|
+
| SCREAMING_SNAKE_CASE | `DATABASE_URL` | `databaseUrl` |
|
|
70
|
+
| Prefixo por servico | `STRIPE_SECRET_KEY` | `SECRET_KEY` |
|
|
71
|
+
| Sem abreviacoes | `DATABASE_POOL_SIZE` | `DB_PS` |
|
|
72
|
+
| Sem dados no nome | `STRIPE_SECRET_KEY` | `STRIPE_SK_LIVE_4242` |
|
|
73
|
+
|
|
74
|
+
### NEXT_PUBLIC_ -- Regras Criticas
|
|
75
|
+
|
|
76
|
+
**PODE ter NEXT_PUBLIC_:**
|
|
77
|
+
- `NEXT_PUBLIC_APP_URL`, `NEXT_PUBLIC_SUPABASE_URL`
|
|
78
|
+
- `NEXT_PUBLIC_SUPABASE_ANON_KEY` (respeita RLS)
|
|
79
|
+
- `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY` (publica por design)
|
|
80
|
+
|
|
81
|
+
**NUNCA pode ter NEXT_PUBLIC_:**
|
|
82
|
+
- `DATABASE_URL`, `STRIPE_SECRET_KEY`, `SUPABASE_SERVICE_ROLE`
|
|
83
|
+
- `JWT_SECRET`, `AWS_SECRET_ACCESS_KEY`
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 3. Estrutura de Arquivos .env
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
project/
|
|
91
|
+
.env.example # Template com placeholders (COMMITADO)
|
|
92
|
+
.env.local # Overrides locais (GITIGNORED)
|
|
93
|
+
.env.development # Defaults dev (commitar se sem secrets)
|
|
94
|
+
.env.test # Valores para testes (commitar)
|
|
95
|
+
.env.staging # GITIGNORED (ou em secrets manager)
|
|
96
|
+
.env.production # NUNCA commitar
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### .gitignore obrigatorio
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
.env
|
|
103
|
+
.env*.local
|
|
104
|
+
.env.staging
|
|
105
|
+
.env.production
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Validacao na Inicializacao (t3-env para Next.js)
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
// src/env.ts
|
|
112
|
+
import { createEnv } from "@t3-oss/env-nextjs";
|
|
113
|
+
import { z } from "zod";
|
|
114
|
+
|
|
115
|
+
export const env = createEnv({
|
|
116
|
+
server: {
|
|
117
|
+
DATABASE_URL: z.string().url(),
|
|
118
|
+
AUTH_JWT_SECRET: z.string().min(32),
|
|
119
|
+
STRIPE_SECRET_KEY: z.string().startsWith("sk_"),
|
|
120
|
+
},
|
|
121
|
+
client: {
|
|
122
|
+
NEXT_PUBLIC_APP_URL: z.string().url(),
|
|
123
|
+
NEXT_PUBLIC_SUPABASE_URL: z.string().url(),
|
|
124
|
+
NEXT_PUBLIC_SUPABASE_ANON_KEY: z.string().min(1),
|
|
125
|
+
},
|
|
126
|
+
runtimeEnv: { /* ... */ },
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 4. Secrets Management Decision Tree
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
100% na AWS?
|
|
136
|
+
|-- SIM --> Precisa de rotation automatica?
|
|
137
|
+
| |-- SIM --> AWS Secrets Manager ($0.40/secret/mes)
|
|
138
|
+
| +-- NAO --> AWS SSM Parameter Store (GRATIS)
|
|
139
|
+
+-- NAO --> Precisa de dynamic secrets / PKI?
|
|
140
|
+
|-- SIM --> HashiCorp Vault (HCP ou self-hosted)
|
|
141
|
+
+-- NAO --> Prioridade e DX e velocidade?
|
|
142
|
+
|-- SIM --> Doppler (gratis ate 3 devs)
|
|
143
|
+
+-- NAO --> Self-hosted?
|
|
144
|
+
|-- SIM --> Infisical (MIT, gratis)
|
|
145
|
+
+-- NAO --> Doppler
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Recomendacao por Perfil
|
|
149
|
+
|
|
150
|
+
| Perfil | Ferramenta | Justificativa |
|
|
151
|
+
|--------|-----------|---------------|
|
|
152
|
+
| Startup ate 5 devs | Doppler Free ou Infisical | Setup em minutos |
|
|
153
|
+
| Time 5-20 devs, multi-cloud | Infisical Cloud ou Doppler | CI/CD integration |
|
|
154
|
+
| Enterprise, compliance | HashiCorp Vault | Dynamic secrets, PKI |
|
|
155
|
+
| 100% AWS | SSM + Secrets Manager | Zero overhead, nativo |
|
|
156
|
+
|
|
157
|
+
### Vercel + Supabase Secrets
|
|
158
|
+
|
|
159
|
+
**Vercel:** Variaveis com scoping Production/Preview/Development no dashboard. Marcar como Sensitive para ocultar valor.
|
|
160
|
+
|
|
161
|
+
**Supabase Edge Functions:**
|
|
162
|
+
```bash
|
|
163
|
+
supabase secrets set STRIPE_SECRET_KEY=<key>
|
|
164
|
+
supabase secrets set RESEND_API_KEY=<key>
|
|
165
|
+
# Acesso: Deno.env.get("STRIPE_SECRET_KEY")
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## 5. Branching Strategy Decision Tree
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
Equipe faz continuous deployment (deploy a cada merge)?
|
|
174
|
+
|-- SIM --> Maturidade alta? Feature flags? CI rapido?
|
|
175
|
+
| |-- SIM --> Trunk-Based Development
|
|
176
|
+
| +-- NAO --> GitHub Flow
|
|
177
|
+
+-- NAO --> Software com releases versionados (mobile, SDK)?
|
|
178
|
+
|-- SIM --> GitFlow
|
|
179
|
+
+-- NAO --> Multiplos ambientes com aprovacao?
|
|
180
|
+
|-- SIM --> GitLab Flow
|
|
181
|
+
+-- NAO --> GitHub Flow
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Comparativo Rapido
|
|
185
|
+
|
|
186
|
+
| Criterio | GitHub Flow | GitLab Flow | GitFlow | TBD |
|
|
187
|
+
|----------|-------------|-------------|---------|-----|
|
|
188
|
+
| Complexidade | Baixa | Media | Alta | Baixa |
|
|
189
|
+
| Deploy frequency | Alta | Media-alta | Baixa | Muito alta |
|
|
190
|
+
| Feature flags | Opcional | Opcional | Opcional | Essencial |
|
|
191
|
+
| Team size | 1-50+ | 5-50 | 5-20 | 10-10K+ |
|
|
192
|
+
| Melhor para | SaaS, web apps | Multi-env | SDKs, mobile | High-perf |
|
|
193
|
+
|
|
194
|
+
### SINAPSE Default: GitHub Flow
|
|
195
|
+
|
|
196
|
+
Para projetos SINAPSE, o padrao e **GitHub Flow** com:
|
|
197
|
+
- Branch `main` sempre deployavel
|
|
198
|
+
- Feature branches curtas (`caio/feat/xxx`, `soier/fix/xxx`)
|
|
199
|
+
- PR obrigatorio com review
|
|
200
|
+
- Deploy automatico apos merge em main
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## 6. Branch-to-Environment Mapping
|
|
205
|
+
|
|
206
|
+
| Branch | Ambiente | Deploy | Aprovacao |
|
|
207
|
+
|--------|----------|--------|-----------|
|
|
208
|
+
| Feature branches | Preview (Vercel) | Automatico (on push) | Nenhuma |
|
|
209
|
+
| `main` | Production (Vercel + Supabase) | Automatico (on merge) | PR approved |
|
|
210
|
+
| `staging` (se existir) | Staging | Automatico | Nenhuma |
|
|
211
|
+
|
|
212
|
+
### Branch Naming (SINAPSE Convention)
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
<user>/<type>/<short-desc>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
| User | Prefixo | Exemplo |
|
|
219
|
+
|------|---------|---------|
|
|
220
|
+
| Caio | `caio/` | `caio/feat/new-checkout` |
|
|
221
|
+
| Matheus | `soier/` | `soier/fix/auth-bug` |
|
|
222
|
+
| Unknown | `dev/` | `dev/feat/feature-x` |
|
|
223
|
+
|
|
224
|
+
Types: `feat`, `fix`, `refactor`, `docs`, `chore`, `test`
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## 7. CI/CD Pipeline Template (GitHub Actions)
|
|
229
|
+
|
|
230
|
+
```yaml
|
|
231
|
+
name: Production Pipeline
|
|
232
|
+
|
|
233
|
+
on:
|
|
234
|
+
push:
|
|
235
|
+
branches: [main]
|
|
236
|
+
pull_request:
|
|
237
|
+
branches: [main]
|
|
238
|
+
|
|
239
|
+
jobs:
|
|
240
|
+
build-and-test:
|
|
241
|
+
runs-on: ubuntu-latest
|
|
242
|
+
steps:
|
|
243
|
+
- uses: actions/checkout@v4
|
|
244
|
+
- uses: actions/setup-node@v4
|
|
245
|
+
with:
|
|
246
|
+
node-version: 20
|
|
247
|
+
cache: 'npm'
|
|
248
|
+
- run: npm ci
|
|
249
|
+
- run: npm run build
|
|
250
|
+
- run: npm run test -- --coverage
|
|
251
|
+
- run: npm run lint
|
|
252
|
+
- run: npm run typecheck
|
|
253
|
+
|
|
254
|
+
security-scan:
|
|
255
|
+
runs-on: ubuntu-latest
|
|
256
|
+
steps:
|
|
257
|
+
- uses: actions/checkout@v4
|
|
258
|
+
- run: npm ci
|
|
259
|
+
- run: npm audit --audit-level=high
|
|
260
|
+
- name: Secret scanning
|
|
261
|
+
run: npx gitleaks detect --source=.
|
|
262
|
+
|
|
263
|
+
# Deploy automatico via Vercel Git Integration
|
|
264
|
+
# (nao precisa de step manual -- Vercel detecta push)
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## 8. Feature Flags Quick-Start
|
|
270
|
+
|
|
271
|
+
### Recomendacao por Perfil
|
|
272
|
+
|
|
273
|
+
| Perfil | Ferramenta | Custo |
|
|
274
|
+
|--------|-----------|-------|
|
|
275
|
+
| Startup / cost-conscious | GrowthBook (self-hosted) | Gratis |
|
|
276
|
+
| Product-led, A/B testing | GrowthBook Cloud ou Statsig | $0-50/mes |
|
|
277
|
+
| Enterprise, compliance | LaunchDarkly | $12+/seat/mes |
|
|
278
|
+
|
|
279
|
+
### Tipos de Flag
|
|
280
|
+
|
|
281
|
+
| Tipo | Duracao | Exemplo |
|
|
282
|
+
|------|---------|---------|
|
|
283
|
+
| Release Flag | Dias-semanas | `flag_new_checkout` |
|
|
284
|
+
| Experiment Flag | Semanas-meses | `exp_pricing_v2` |
|
|
285
|
+
| Ops Flag | Permanente | `ops_enable_cache` |
|
|
286
|
+
| Kill Switch | Permanente | `kill_external_payment` |
|
|
287
|
+
|
|
288
|
+
**Regra:** Release flags DEVEM ser removidas em 30 dias apos 100%.
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## 9. Rollback Procedures
|
|
293
|
+
|
|
294
|
+
### Vercel
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Listar deployments
|
|
298
|
+
vercel ls
|
|
299
|
+
|
|
300
|
+
# Reverter para deployment anterior
|
|
301
|
+
vercel rollback [deployment-url]
|
|
302
|
+
|
|
303
|
+
# Ou via dashboard: Deployments > ... > Promote to Production
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Supabase (Database)
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
# Listar migrations
|
|
310
|
+
supabase migration list
|
|
311
|
+
|
|
312
|
+
# Reverter migration (criar migration reversa)
|
|
313
|
+
supabase migration new revert_last_change
|
|
314
|
+
# Escrever SQL de rollback manualmente
|
|
315
|
+
|
|
316
|
+
# Point-in-Time Recovery (Pro plan)
|
|
317
|
+
# Dashboard > Database > Backups > Restore to point in time
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Git
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
# Reverter ultimo commit em main (cria novo commit)
|
|
324
|
+
git revert HEAD
|
|
325
|
+
git push origin main
|
|
326
|
+
|
|
327
|
+
# NUNCA usar git reset --hard em branches compartilhadas
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## 10. Commit Convention (Conventional Commits)
|
|
333
|
+
|
|
334
|
+
```
|
|
335
|
+
<type>(<scope>): <description>
|
|
336
|
+
|
|
337
|
+
feat(auth): add Google OAuth login
|
|
338
|
+
fix(cart): correct total calculation with discounts
|
|
339
|
+
docs(api): update authentication guide
|
|
340
|
+
chore(deps): update next.js to 15.2
|
|
341
|
+
refactor(db): extract query builder module
|
|
342
|
+
test(payment): add Stripe webhook integration tests
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Types: `feat`, `fix`, `docs`, `chore`, `refactor`, `test`, `perf`, `ci`, `style`, `revert`
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## 11. Cross-References
|
|
350
|
+
|
|
351
|
+
- Infrastructure tiers: ver `infrastructure-decision-framework.md`
|
|
352
|
+
- Database environments: ver `database-scaling-patterns.md`
|
|
353
|
+
- Security checklist pre-deploy: ver `security-pre-deploy-checklist.md`
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Gotchas & Error Patterns
|
|
2
|
+
|
|
3
|
+
> **Agente(s):** ALL agents
|
|
4
|
+
> **Uso:** Consult BEFORE debugging -- the answer may already be here.
|
|
5
|
+
> Auto-populated by agents when encountering recurring errors.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Format
|
|
10
|
+
|
|
11
|
+
Each entry follows:
|
|
12
|
+
- **Pattern:** What the error looks like
|
|
13
|
+
- **Root Cause:** Why it happens
|
|
14
|
+
- **Fix:** How to resolve it
|
|
15
|
+
- **Agents:** Which agents encounter this
|
|
16
|
+
- **Added:** Date first documented
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Git & CI/CD Gotchas
|
|
21
|
+
|
|
22
|
+
### G-GIT-01: Push blocked by hook
|
|
23
|
+
|
|
24
|
+
- **Pattern:** `BLOCKED: Only @devops (Pipeline) can execute git push` when any agent tries to push
|
|
25
|
+
- **Root Cause:** `enforce-git-push-authority.sh` hook enforces Constitution Article II -- only @devops has push authority
|
|
26
|
+
- **Fix:** Delegate push to @devops via `*push`. Never attempt `git push` from @developer or other agents
|
|
27
|
+
- **Agents:** @developer, @architect, @quality-gate
|
|
28
|
+
- **Added:** 2026-01-15
|
|
29
|
+
|
|
30
|
+
### G-GIT-02: Working on main branch
|
|
31
|
+
|
|
32
|
+
- **Pattern:** Agent starts coding directly on `main`, later blocked by branch protection or creates merge conflicts
|
|
33
|
+
- **Root Cause:** Session start did not follow Safe Collaboration protocol (auto-branch)
|
|
34
|
+
- **Fix:** Always create a feature branch before any work. Pattern: `{user}/{type}/{short-desc}` (e.g., `caio/feat/new-feature`). Run `git fetch origin` + check branch at session start
|
|
35
|
+
- **Agents:** @developer
|
|
36
|
+
- **Added:** 2026-01-15
|
|
37
|
+
|
|
38
|
+
### G-GIT-03: Merge conflict on package-lock.json
|
|
39
|
+
|
|
40
|
+
- **Pattern:** `CONFLICT (content): Merge conflict in package-lock.json` after pulling main
|
|
41
|
+
- **Root Cause:** Two branches modified dependencies independently
|
|
42
|
+
- **Fix:** Delete `package-lock.json`, run `npm install` to regenerate, then commit the new lockfile. Never manually resolve lockfile conflicts
|
|
43
|
+
- **Agents:** @developer, @devops
|
|
44
|
+
- **Added:** 2026-02-10
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Hook & Permission Gotchas
|
|
49
|
+
|
|
50
|
+
### G-HOOK-01: Story gate blocks code writing
|
|
51
|
+
|
|
52
|
+
- **Pattern:** `BLOCKED: No story found for this work` when trying to Write/Edit source files
|
|
53
|
+
- **Root Cause:** `enforce-story-gate.cjs` requires a valid story in `docs/stories/` with status >= Ready before code changes
|
|
54
|
+
- **Fix:** Create a story via @sprint-lead `*draft`, validate via @product-lead `*validate`, then proceed with implementation. Framework governance work by @sinapse-orqx is exempt
|
|
55
|
+
- **Agents:** @developer
|
|
56
|
+
- **Added:** 2026-01-20
|
|
57
|
+
|
|
58
|
+
### G-HOOK-02: Architecture-first gate blocks protected paths
|
|
59
|
+
|
|
60
|
+
- **Pattern:** `BLOCKED: Architecture documentation required before modifying protected paths` when editing core files
|
|
61
|
+
- **Root Cause:** `enforce-architecture-first.cjs` requires architecture docs before modifying L1/L2 paths
|
|
62
|
+
- **Fix:** Document the architectural decision first, then modify the code. Check `.claude/rules/hook-governance.md` for which paths are protected
|
|
63
|
+
- **Agents:** @developer, @architect
|
|
64
|
+
- **Added:** 2026-02-01
|
|
65
|
+
|
|
66
|
+
### G-HOOK-03: Delegation hook blocks orchestrator execution
|
|
67
|
+
|
|
68
|
+
- **Pattern:** `BLOCKED: Orchestrators cannot execute domain work directly` when an orchestrator tries to write code
|
|
69
|
+
- **Root Cause:** `enforce-delegation.cjs` enforces Constitution Article VIII -- orchestrators must delegate
|
|
70
|
+
- **Fix:** The orchestrator must delegate to the appropriate specialist agent. Orchestrators can only do routing, diagnostics, and coordination
|
|
71
|
+
- **Agents:** @sinapse-orqx, all *-orqx orchestrators
|
|
72
|
+
- **Added:** 2026-02-15
|
|
73
|
+
|
|
74
|
+
### G-HOOK-04: Hook crashes but operation proceeds
|
|
75
|
+
|
|
76
|
+
- **Pattern:** Hook outputs an error traceback but the operation is NOT blocked (exit code 0)
|
|
77
|
+
- **Root Cause:** Hooks follow fail-open design -- if a hook crashes or cannot parse input, it exits 0 (allow)
|
|
78
|
+
- **Fix:** This is by design. Fix the hook itself if the crash is recurring, but do not rely on broken hooks for enforcement. Report to @devops
|
|
79
|
+
- **Agents:** ALL
|
|
80
|
+
- **Added:** 2026-03-01
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Testing Gotchas
|
|
85
|
+
|
|
86
|
+
### G-TEST-01: Tests pass locally but fail in CI
|
|
87
|
+
|
|
88
|
+
- **Pattern:** `npm test` passes on developer machine but CI reports failures
|
|
89
|
+
- **Root Cause:** Common causes: (1) tests depend on OS-specific paths (Windows backslashes vs Unix forward slashes), (2) timezone-dependent assertions, (3) missing environment variables in CI, (4) test execution order dependency
|
|
90
|
+
- **Fix:** Use `path.join()` or `path.posix` for paths. Use UTC in date assertions. Add required env vars to CI config. Ensure tests are independently runnable with `--randomize`
|
|
91
|
+
- **Agents:** @developer, @quality-gate
|
|
92
|
+
- **Added:** 2026-02-20
|
|
93
|
+
|
|
94
|
+
### G-TEST-02: MSW handlers not intercepting requests
|
|
95
|
+
|
|
96
|
+
- **Pattern:** Integration tests hit real API endpoints instead of MSW mocks, causing timeouts or unexpected data
|
|
97
|
+
- **Root Cause:** MSW server not started before tests, or handler URL does not match the actual request URL (trailing slashes, query params, base URL mismatch)
|
|
98
|
+
- **Fix:** Verify `server.listen()` in `beforeAll`, `server.resetHandlers()` in `afterEach`, `server.close()` in `afterAll`. Match URLs exactly including protocol and path
|
|
99
|
+
- **Agents:** @developer, @quality-gate
|
|
100
|
+
- **Added:** 2026-03-10
|
|
101
|
+
|
|
102
|
+
### G-TEST-03: Vitest snapshot mismatch after dependency update
|
|
103
|
+
|
|
104
|
+
- **Pattern:** `Snapshot mismatch` errors across multiple test files after updating a UI library
|
|
105
|
+
- **Root Cause:** Component HTML output changed with the library update, invalidating stored snapshots
|
|
106
|
+
- **Fix:** Review the snapshot diffs. If changes are expected, run `vitest --update` to regenerate snapshots. Prefer `toHaveTextContent`/`toHaveAttribute` assertions over snapshots for resilience
|
|
107
|
+
- **Agents:** @developer
|
|
108
|
+
- **Added:** 2026-03-15
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## MCP & Browser Gotchas
|
|
113
|
+
|
|
114
|
+
### G-MCP-01: Docker MCP secrets not passed to containers
|
|
115
|
+
|
|
116
|
+
- **Pattern:** `docker mcp tools ls` shows "(N prompts)" instead of "(N tools)". MCP server starts but fails authentication
|
|
117
|
+
- **Root Cause:** Docker MCP Toolkit secrets store and template interpolation do not work properly (known bug Dec 2025+). Credentials set via `docker mcp secret set` are NOT passed to containers
|
|
118
|
+
- **Fix:** Edit `~/.docker/mcp/catalogs/docker-mcp.yaml` directly with hardcoded env values. See `.claude/rules/mcp-usage.md` for details
|
|
119
|
+
- **Agents:** @devops
|
|
120
|
+
- **Added:** 2026-01-10
|
|
121
|
+
|
|
122
|
+
### G-MCP-02: Using docker-gateway for local file operations
|
|
123
|
+
|
|
124
|
+
- **Pattern:** File read/write fails with path errors like `/mnt/c/Users/...` not found, or operations are unexpectedly slow
|
|
125
|
+
- **Root Cause:** Using `docker-gateway` MCP for operations that should use native Claude Code tools. Docker runs in a Linux container with different filesystem paths
|
|
126
|
+
- **Fix:** Always use native tools for local operations: `Read` for files, `Write`/`Edit` for writing, `Bash` for commands, `Grep` for search. Only use docker-gateway for MCP servers running inside Docker (EXA, Context7, Apify)
|
|
127
|
+
- **Agents:** ALL
|
|
128
|
+
- **Added:** 2026-01-25
|
|
129
|
+
|
|
130
|
+
### G-MCP-03: Chrome DevTools MCP connection refused
|
|
131
|
+
|
|
132
|
+
- **Pattern:** `Connection refused` or `Cannot connect to browser` when using chrome-devtools MCP
|
|
133
|
+
- **Root Cause:** Chrome not launched with remote debugging enabled, or port conflict
|
|
134
|
+
- **Fix:** Launch Chrome with `--remote-debugging-port=9222`. Ensure no other process is using port 9222. On Windows, close all Chrome instances first
|
|
135
|
+
- **Agents:** @developer, @quality-gate
|
|
136
|
+
- **Added:** 2026-02-28
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Supabase & Database Gotchas
|
|
141
|
+
|
|
142
|
+
### G-DB-01: RLS enabled but no policies -- data inaccessible
|
|
143
|
+
|
|
144
|
+
- **Pattern:** Supabase queries return empty arrays even though data exists in the table
|
|
145
|
+
- **Root Cause:** RLS was enabled on the table (`ALTER TABLE ... ENABLE ROW LEVEL SECURITY`) but no policies were created. PostgreSQL default is deny-all when RLS is active without policies
|
|
146
|
+
- **Fix:** Create explicit policies for each operation (SELECT, INSERT, UPDATE, DELETE). At minimum: `CREATE POLICY "allow_authenticated" ON table FOR SELECT TO authenticated USING (true)`
|
|
147
|
+
- **Agents:** @data-engineer, @developer
|
|
148
|
+
- **Added:** 2026-01-15
|
|
149
|
+
|
|
150
|
+
### G-DB-02: RLS performance degradation -- slow queries
|
|
151
|
+
|
|
152
|
+
- **Pattern:** API response times increase from <100ms to 500ms+ as data grows, EXPLAIN ANALYZE shows sequential scans
|
|
153
|
+
- **Root Cause:** RLS policy columns not indexed, or `auth.uid()` called without wrapping in `SELECT` subquery
|
|
154
|
+
- **Fix:** (1) Index all columns used in RLS policies: `CREATE INDEX idx_user ON table(user_id)`. (2) Use `(SELECT auth.uid()) = user_id` instead of `auth.uid() = user_id` (up to 95% faster due to caching). (3) Add explicit `.eq()` filters in SDK queries
|
|
155
|
+
- **Agents:** @data-engineer, @developer
|
|
156
|
+
- **Added:** 2026-02-05
|
|
157
|
+
|
|
158
|
+
### G-DB-03: service_role key exposed in frontend
|
|
159
|
+
|
|
160
|
+
- **Pattern:** Security scan detects `service_role` key in client-side bundle or `NEXT_PUBLIC_` variable
|
|
161
|
+
- **Root Cause:** Developer accidentally used service_role key (which bypasses RLS) instead of anon key in frontend code
|
|
162
|
+
- **Fix:** Immediately rotate the exposed key in Supabase Dashboard. Use ONLY `anon` key with `NEXT_PUBLIC_` prefix. Keep `service_role` in server-only env vars (no `NEXT_PUBLIC_` prefix). Add secret scanning hook
|
|
163
|
+
- **Agents:** @developer, @devops
|
|
164
|
+
- **Added:** 2026-01-20
|
|
165
|
+
|
|
166
|
+
### G-DB-04: SQL Editor bypasses RLS -- false sense of security
|
|
167
|
+
|
|
168
|
+
- **Pattern:** Developer tests RLS policies in Supabase SQL Editor and sees all data, concluding RLS is broken
|
|
169
|
+
- **Root Cause:** The SQL Editor runs with superuser/service_role privileges, which bypasses RLS entirely
|
|
170
|
+
- **Fix:** Test RLS policies using the Supabase client SDK (JS/Python) with the anon key, not the SQL Editor. Alternatively, use `SET ROLE authenticated; SET request.jwt.claims = '{"sub":"user-uuid"}'` in SQL to simulate a user
|
|
171
|
+
- **Agents:** @data-engineer, @developer
|
|
172
|
+
- **Added:** 2026-03-01
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## NPM & Publishing Gotchas
|
|
177
|
+
|
|
178
|
+
### G-NPM-01: npm publish fails with 403
|
|
179
|
+
|
|
180
|
+
- **Pattern:** `npm ERR! 403 Forbidden - PUT https://registry.npmjs.org/sinapse-ai` when publishing
|
|
181
|
+
- **Root Cause:** (1) Not logged in to npm, (2) package name already taken by another user, (3) npm token expired, or (4) 2FA required but not provided
|
|
182
|
+
- **Fix:** Run `npm login` to refresh auth. Check package name availability with `npm view <name>`. For scoped packages, ensure the org exists. For 2FA, use `npm publish --otp=<code>`
|
|
183
|
+
- **Agents:** @devops
|
|
184
|
+
- **Added:** 2026-02-10
|
|
185
|
+
|
|
186
|
+
### G-NPM-02: Version conflict on publish
|
|
187
|
+
|
|
188
|
+
- **Pattern:** `npm ERR! 403 - cannot publish over previously published version` when trying to publish
|
|
189
|
+
- **Root Cause:** The version in `package.json` already exists on the npm registry
|
|
190
|
+
- **Fix:** Bump the version using `npm version patch|minor|major` before publishing. Use `pre-commit-version-check.sh` hook to catch this early
|
|
191
|
+
- **Agents:** @devops
|
|
192
|
+
- **Added:** 2026-02-15
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Next.js & Vercel Gotchas
|
|
197
|
+
|
|
198
|
+
### G-NEXT-01: Server Component importing client-only code
|
|
199
|
+
|
|
200
|
+
- **Pattern:** `Error: useState is not a function` or `Error: window is not defined` in a Server Component
|
|
201
|
+
- **Root Cause:** Server Components cannot use React hooks (useState, useEffect, etc.) or browser APIs (window, document). All components are Server Components by default in App Router
|
|
202
|
+
- **Fix:** Add `'use client'` directive at the top of files that need interactivity. Keep the client boundary as small as possible -- pass Server Components as `children` to Client Components
|
|
203
|
+
- **Agents:** @developer
|
|
204
|
+
- **Added:** 2026-03-05
|
|
205
|
+
|
|
206
|
+
### G-NEXT-02: NEXT_PUBLIC_ variable undefined at runtime
|
|
207
|
+
|
|
208
|
+
- **Pattern:** `process.env.NEXT_PUBLIC_API_URL` is `undefined` in the browser even though it is set in `.env.local`
|
|
209
|
+
- **Root Cause:** `NEXT_PUBLIC_` variables are inlined at BUILD time, not runtime. If the variable was added after the last build, it will not be available
|
|
210
|
+
- **Fix:** Restart the dev server (`npm run dev`) after adding new env vars. For production, redeploy after changing environment variables in Vercel Dashboard
|
|
211
|
+
- **Agents:** @developer
|
|
212
|
+
- **Added:** 2026-03-10
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## How to Add New Entries
|
|
217
|
+
|
|
218
|
+
When encountering a recurring error (seen 2+ times), add a new entry:
|
|
219
|
+
|
|
220
|
+
1. Choose the appropriate category (or create a new one)
|
|
221
|
+
2. Use the next sequential ID: `G-{CATEGORY}-{NN}`
|
|
222
|
+
3. Fill in all fields: Pattern, Root Cause, Fix, Agents, Added
|
|
223
|
+
4. Keep descriptions concise -- max 3 lines per field
|
|
224
|
+
5. Reference relevant documentation or hook files when applicable
|