diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3dccc89 --- /dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ +# Secrets / credenciais +.env +.env.* +*.pem +RSA_* +CREDENCIAIS.md + +# Python +__pycache__/ +*.py[cod] +*.egg-info/ +.pytest_cache/ +.mypy_cache/ +.venv/ +venv/ + +# Backups locais +backup/ + +# Logs +*.log +logs/ + +# Claude / swarm +.claude/ +.claude-flow/ +.mcp.json +.swarm/ + +# Gitea token (NAO COMMITAR) +.gitea_token + +# Backups locais antigos (CLAUDE.md.bak.*, etc) +*.bak +*.bak.* +CLAUDE.md.bak.* diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..ec84464 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,282 @@ +# CLAUDE.md — Motor E-commerce Multi-Canal Brasil +**Dono:** Iris Florencio | irisflorencio@yahoo.com.br +**Atualizado:** 06/jul/2026 +**VPS:** 31.220.78.126 (Ubuntu 24.04, 193GB disco, 11GB RAM) +**Gateway:** Hermes + Telegram bot @OB1s + +--- + +## Projeto + +Motor e-commerce multi-canal para o mercado brasileiro. +Objetivo: operar Amazon, Mercado Livre, Shopee, Magazine Luiza, TikTok Shop e Site Próprio +a partir de um motor centralizado (Saleor + PostgreSQL + Redis + n8n + WhatsApp). + +--- + +## Status Atual (06/jul/2026 — pós-higienização) + +| Sistema | Status | URL | Container | +|---------|--------|-----|-----------| +| Traefik | ✅ | http://31.220.78.126:8090 | m5_traefik | +| Saleor | ✅ | loja.m5digital.net.br | m5_saleor | +| Saleor Dashboard | ✅ | dashboard.m5digital.net.br | m5_saleor_dashboard | +| PostgreSQL | ✅ | - | m5_postgres | +| Redis | ✅ | - | m5_redis | +| Gitea | ✅ | git.m5digital.net.br | m5_gitea | +| n8n | ⚠️ PARCIAL | n8n.m5digital.net.br | m5_n8n (login quebrado) | +| OpenWA | ✅ | wa.m5digital.net.br | m5_openwa | +| Chatwoot | ✅ | chat.m5digital.net.br | chatwoot-chatwoot-1 | +| Twenty CRM | ✅ | crm.m5digital.net.br | twenty_front (substituiu Hermes CRM) | +| Portainer | ✅ | http://31.220.78.126:9443 | portainer | +| yt-pub-livesx | ✅ | video.m5digital.net.br | yt-pub-livesx-dashboard-1 | +| Omniroute | ✅ | gateway.digitalavello.shop | omniroute | + +**20 containers ativos** · **9 subdomínios HTTPS validados** · **0 produtos Saleor** + +--- + +## Estrutura de Diretórios + +``` +/root/ecommerce/ # RAIZ na VPS +├── HANDOFF-2026-07-06.md # Estado completo + plano +├── CLAUDE.md # ESTE ARQUIVO +├── vault/ # Obsidian KB — fonte de verdade +│ ├── checkpoint-2026-06-22.md +│ └── ecommerce-kb/ +│ ├── HOME.md +│ ├── DASHBOARD.md +│ ├── SYSTEMS-STATUS.md # Status atual (atualizado 06/jul) +│ ├── HIGIENIZACAO-06jul2026.md # Log da limpeza desta sessão +│ ├── N8N-WORKFLOWS.md +│ ├── TWENTY-CRM-SETUP.md +│ ├── CHATWOOT-SETUP.md +│ ├── INTEGRATIONS.md +│ └── ... +├── scripts/ # Scripts + Docker +│ ├── docker-compose.m5.yml # Stack completa M5 +│ ├── openwa-compose.yml # WhatsApp (OpenWA v0.5.0) +│ ├── traefik-conf/ +│ │ ├── traefik.yml +│ │ ├── routes.yml # 9 subdomínios HTTPS +│ │ └── dynamic-config.yml +│ ├── backups/ +│ ├── calculators/ +│ ├── compliance/ +│ └── skills/ +├── skills/ # Skills Hermes (18 marketplaces) +├── ecom-store/ # Repo de código (git + Gitea) +│ ├── utils/ +│ │ ├── m5log.py # Logger M5 (3 modos: text/json/json_clean) +│ │ └── example_usage.py +│ ├── README.md +│ └── .gitignore # inclui .gitea_token +├── workflows/ # n8n workflows +│ ├── m5-openwa-to-twenty.json # WhatsApp → CRM (importar via UI) +│ ├── m5-twenty-to-openwa.json # CRM → WhatsApp +│ ├── chatwoot-integration.json +│ ├── README-FASE5-OPENWA-TWENTY.md +│ └── n8n-current/ # (vazio, stubs movidos para backup) +├── backup/ # Snapshots do vault + workflows stubs +├── logs/ # Logs m5log (JSON clean rotacionado) +└── .gitea_token # Git token (chmod 600, gitignored) +``` + +--- + +## Mudanças Recentes (06/jul/2026) + +### Substituições +- **Hermes CRM → Twenty CRM** — backup em `/root/backups/2026-07-06_pre-crm-reorg/` +- Container `twenty_front` na porta 3000, atrás de `crm-https` no Traefik + +### Higienização (~7.4GB liberados) +- 14 volumes Docker órfãos removidos +- 2 networks órfãs removidas +- 14 imagens Docker sem uso removidas +- Traefik limpo (IPs hardcoded → service names) +- 3 workflows n8n stubs movidos para backup local + +### Validação +- 9/9 subdomínios HTTP 200 +- Traefik dashboard UP +- OpenWA `marcos-pessoal` sessão READY +- Gitea repo `ecom-store` pushado (2 commits) + +--- + +## Pendências Críticas (06/jul/2026) + +1. **n8n login quebrado** — wizard de senha não aceita (auth layer além do DB resetado) +2. **Sessão WhatsApp `bussines-m5`** — QR não escaneado +3. **Saleor sem produtos** — zerado em 21/jun, aguardando catalogação +4. **Workflows reais do n8n** — JSON pronto mas precisa importar via UI (depende #1) +5. **Webhook OpenWA → n8n** — depende sessão ativa + +--- + +## Stack de Integração + +| Camada | Componente | +|--------|------------| +| Motor e-commerce | Saleor 3.23 + PostgreSQL 16 + Redis 7 | +| Orquestração | n8n 2.27.4 (workflows em `/root/ecommerce/workflows/`) | +| Proxy | Traefik 3.0 + Let's Encrypt (dedyn.io) | +| WhatsApp | OpenWA v0.5.0 (ghcr.io/rmyndharis/openwa) | +| CRM | Twenty CRM 1.x (twentycrm/twenty) | +| Suporte | Chatwoot 3.3.0 | +| Código | Gitea 1.22.6 | +| LLMs | custom:aibee (aibee.cloud) + Ollama qwen3.6/deepseek-v4 | +| GPU | NVIDIA APIs (build.nvidia.com) — Nemotron, Kimi | + +--- + +## URLs dos Serviços + +| Serviço | URL | +|---------|-----| +| Traefik Dashboard | http://31.220.78.126:8090 | +| Saleor API | https://loja.m5digital.net.br/graphql/ | +| Saleor Dashboard | https://dashboard.m5digital.net.br | +| Gitea | https://git.m5digital.net.br | +| n8n | https://n8n.m5digital.net.br | +| OpenWA Dashboard | https://wa.m5digital.net.br | +| OpenWA API | https://wa.m5digital.net.br/api | +| Chatwoot | https://chat.m5digital.net.br | +| Twenty CRM | https://crm.m5digital.net.br | +| yt-pub-livesx | https://video.m5digital.net.br | +| Omniroute | https://gateway.digitalavello.shop | +| Portainer | http://31.220.78.126:9443 | + +--- + +## OpenWA — WhatsApp Business + +- **Software:** rmyndharis/OpenWA v0.5.0 (MIT, NestJS + whatsapp-web.js + React) +- **Container:** `m5_openwa` +- **Porta interna:** 2785 +- **Dashboard:** https://wa.m5digital.net.br +- **API:** https://wa.m5digital.net.br/api +- **API Key (regenerada 29/jun/2026):** `owa_k1_1e56b98c39a2daa5bdb537d04f35da17117021bedc8c1de80eaba2926c584b39` +- **Persistência:** bind mount `/root/ecommerce/scripts/openwa-sessions/` → `/app/data/` +- **Sessões:** + - `marcos-pessoal` — **READY** ✓ + - `bussines-m5` — **PENDENTE** (escanear QR no dashboard) + +--- + +## Twenty CRM — Cliente/CRM + +- **Software:** Twenty CRM 1.x (MIT) +- **Container:** `twenty_front` (NestJS frontend) +- **Backend:** `twenty_postgres` (5434) + `twenty_redis` +- **URL:** https://crm.m5digital.net.br +- **Traefik route:** `crm-https` → `twenty_front:3000` +- **Setup:** wizard via browser (em andamento pela Iris) +- **Integração n8n:** workflows em `/root/ecommerce/workflows/m5-*-twenty.json` + +--- + +## Chatwoot — Suporte + +- **Software:** Chatwoot v3.3.0 (Ruby on Rails) +- **Container:** `chatwoot-chatwoot-1` +- **Admin:** Marcos Moreira (admin@m5online.com.br) +- **Account ID:** 1 (M5 Digital) +- **API Token:** `AwnRiNkenTfzmipP8sM4dewQ` +- **API Base:** https://chat.m5digital.net.br/api/v1 +- **Rede Docker:** `scripts_m5_network` + +--- + +## Gitea — Código + +- **Software:** Gitea 1.22.6 +- **Container:** `m5_gitea` +- **URL:** https://git.m5digital.net.br +- **Repo principal:** `m5digital/ecom-store` (push feito 06/jul, 2 commits) +- **Token de acesso:** `/root/ecommerce/.gitea_token` (chmod 600, fora do git) +- **SSH:** porta 2222 + +--- + +## Configurações de Credenciais + +### .env da VPS +- **File:** `/root/ecommerce/scripts/.env` +- **Contém:** credenciais PostgreSQL, Redis, Saleor, Gitea, n8n, OpenWA API keys + +### .env Hermes +- **File:** `/root/.hermes/.env` +- **Contém:** `ANTHROPIC_BASE_URL=https://gateway.digitalavello.shop` + +### Claude Code na VPS +- **Wrapper:** `/usr/local/bin/cc` +- **Key file:** `/root/.claude_keys/key` (mode 600) +- **Modelo:** claude-sonnet-4-6 via digitalavello.shop + +--- + +## Cron Jobs Ativos + +| Job | Schedule | Status | +|-----|----------|--------| +| M5 — Resumo Diário 08:00 | `0 8 * * *` | ok | +| M5 — Check Docker Health | `0 */2 * * *` | ok | +| M5 — Compliance Check 14:00 | `0 14 * * *` | ok | +| M5 — Backup Vault 02:00 | `0 2 * * *` | pausado | + +--- + +## Canais de Venda (prioridade) + +| # | Canal | Status | Tipo | +|---|-------|--------|------| +| 1 | Mercado Livre | SKILL pronta | Marketplace | +| 2 | Shopee | SKILL pronta | Marketplace | +| 3 | Amazon | SKILL pronta | Marketplace (FBA) | +| 4 | Magazine Luiza | SKILL pronta | Marketplace | +| 5 | TikTok Shop | SKILL pronta | Marketplace + Live Commerce | +| 6 | Site Próprio | SKILL pronta | B2C / B2B | + +--- + +## Recursos INEMA Disponíveis + +Tudo em `/root/inema_materiais/`: +- `viralads/` — curso UGC, ViralAds +- `yt-pub-livesx/` — pipeline vídeo automatizado (Docker) +- `ads-skill.zip` (ja instalado em `~/.hermes/skills/ads-skill/`) +- `ClaudeOS-Hermes-V2.3.zip` — dashboard operacional (88MB) + +--- + +## Regras de Operação + +1. **NUNCA criar arquivos em root** — usar `/root/ecommerce/` +2. **Secrets** vão em `.env` — nunca comitar +3. **Vault Obsidian** (`/root/ecommerce/vault/`) é fonte de verdade +4. **Skills** em `/root/ecommerce/skills/` e `~/.hermes/skills/ecommerce/` +5. **Rede Docker:** `scripts_m5_network` — todos os containers nela +6. **Porta OpenWA:** 2785 (NÃO 8002 — legado) +7. **Aprovar item a item** antes de executar ações autônomas +8. **Apresentar plano** antes de agir +9. **Trabalho completo** — não só planos +10. **Autoverificar código** antes de entregar (skill-auto-verify) +11. **Questionar respostas medíocres** — nunca aceitar "ok" +12. **Manter contexto pequeno** — compactar se > 60% + +--- + +## Referências Rápidas + +- `/root/ecommerce/HANDOFF-2026-07-06.md` — handoff completo da operação +- `/root/ecommerce/vault/ecommerce-kb/SYSTEMS-STATUS.md` — status atual dos sistemas +- `/root/ecommerce/vault/ecommerce-kb/HIGIENIZACAO-06jul2026.md` — log da limpeza +- `/root/ecommerce/workflows/README-FASE5-OPENWA-TWENTY.md` — passo-a-passo Fase 5 +- `/root/ecommerce/scripts/traefik-conf/routes.yml` — roteamento HTTP +- `/root/ecommerce/ecom-store/utils/m5log.py` — Logger M5 (303 linhas) +- `/root/.claude/CLAUDE.md` — Skills Hermes auto-invocadas +- `/root/inema_materiais/` — Material INEMA (cursos, ads, vídeo) +- `/root/backups/2026-07-06_pre-crm-reorg/MANIFEST.md` — Inventário pré-CRM \ No newline at end of file diff --git a/workflows/n8n-current/chatwoot-webhook-001.json b/workflows/n8n-current/chatwoot-webhook-001.json deleted file mode 100644 index 787ee55..0000000 --- a/workflows/n8n-current/chatwoot-webhook-001.json +++ /dev/null @@ -1 +0,0 @@ -{"updatedAt":"2026-06-24T18:19:47.656Z","createdAt":"2026-06-24T18:19:47.656Z","id":"chatwoot-webhook-001","name":"Chatwoot Webhook Receiver","description":null,"active":true,"isArchived":false,"nodes":[{"id":"webhook1","type":"n8n-nodes-base.webhook","position":[100,300],"parameters":{"httpMethod":"POST","path":"chatwoot-webhook","responseMode":"responseNode","options":{"authentication":"none"}},"webhookId":"chatwoot-wh-001"}],"connections":{"webhook1":{"main":[[{"node":"respond1","type":"main","index":0}]]}},"settings":{"saveExecutionProgress":true,"saveManualExecutions":true,"callerPolicy":"workflowsFromSameOwner"},"staticData":null,"meta":null,"nodeGroups":[],"pinData":null,"versionId":"chatwoot-version-001","activeVersionId":"chatwoot-version-001","versionCounter":2,"triggerCount":1,"sourceWorkflowId":null,"tags":[],"shared":[{"updatedAt":"2026-06-24T18:36:33.199Z","createdAt":"2026-06-24T18:36:33.199Z","role":"workflow:owner","workflowId":"chatwoot-webhook-001","projectId":"default-project-001","project":{"updatedAt":"2026-06-24T18:36:33.131Z","createdAt":"2026-06-24T18:36:33.131Z","id":"default-project-001","name":"Default","type":"personal","icon":null,"description":null,"customTelemetryTags":[],"creatorId":"admin-id"}}],"versionMetadata":{"name":"Chatwoot Webhook Receiver","description":null}} \ No newline at end of file diff --git a/workflows/n8n-current/saleor-webhook-001.json b/workflows/n8n-current/saleor-webhook-001.json deleted file mode 100644 index 1907671..0000000 --- a/workflows/n8n-current/saleor-webhook-001.json +++ /dev/null @@ -1 +0,0 @@ -{"updatedAt":"2026-06-24T18:19:47.666Z","createdAt":"2026-06-24T18:19:47.666Z","id":"saleor-webhook-001","name":"Saleor Webhook Receiver","description":null,"active":true,"isArchived":false,"nodes":[{"id":"webhook3","type":"n8n-nodes-base.webhook","position":[100,300],"parameters":{"httpMethod":"POST","path":"saleor-webhook","responseMode":"responseNode","options":{"authentication":"none"}},"webhookId":"saleor-wh-001"}],"connections":{"webhook3":{"main":[[{"node":"respond3","type":"main","index":0}]]}},"settings":{"saveExecutionProgress":true,"saveManualExecutions":true,"callerPolicy":"workflowsFromSameOwner"},"staticData":null,"meta":null,"nodeGroups":[],"pinData":null,"versionId":"saleor-version-001","activeVersionId":"saleor-version-001","versionCounter":2,"triggerCount":1,"sourceWorkflowId":null,"tags":[],"shared":[{"updatedAt":"2026-06-24T18:36:33.199Z","createdAt":"2026-06-24T18:36:33.199Z","role":"workflow:owner","workflowId":"saleor-webhook-001","projectId":"default-project-001","project":{"updatedAt":"2026-06-24T18:36:33.131Z","createdAt":"2026-06-24T18:36:33.131Z","id":"default-project-001","name":"Default","type":"personal","icon":null,"description":null,"customTelemetryTags":[],"creatorId":"admin-id"}}],"versionMetadata":{"name":"Saleor Webhook Receiver","description":null}} \ No newline at end of file diff --git a/workflows/n8n-current/twenty-webhook-001.json b/workflows/n8n-current/twenty-webhook-001.json deleted file mode 100644 index dce00f0..0000000 --- a/workflows/n8n-current/twenty-webhook-001.json +++ /dev/null @@ -1 +0,0 @@ -{"updatedAt":"2026-06-24T18:19:47.663Z","createdAt":"2026-06-24T18:19:47.663Z","id":"twenty-webhook-001","name":"Twenty CRM Webhook Receiver","description":null,"active":true,"isArchived":false,"nodes":[{"id":"webhook2","type":"n8n-nodes-base.webhook","position":[100,300],"parameters":{"httpMethod":"POST","path":"twenty-webhook","responseMode":"responseNode","options":{"authentication":"none"}},"webhookId":"twenty-wh-001"}],"connections":{"webhook2":{"main":[[{"node":"respond2","type":"main","index":0}]]}},"settings":{"saveExecutionProgress":true,"saveManualExecutions":true,"callerPolicy":"workflowsFromSameOwner"},"staticData":null,"meta":null,"nodeGroups":[],"pinData":null,"versionId":"twenty-version-001","activeVersionId":"twenty-version-001","versionCounter":2,"triggerCount":1,"sourceWorkflowId":null,"tags":[],"shared":[{"updatedAt":"2026-06-24T18:36:33.199Z","createdAt":"2026-06-24T18:36:33.199Z","role":"workflow:owner","workflowId":"twenty-webhook-001","projectId":"default-project-001","project":{"updatedAt":"2026-06-24T18:36:33.131Z","createdAt":"2026-06-24T18:36:33.131Z","id":"default-project-001","name":"Default","type":"personal","icon":null,"description":null,"customTelemetryTags":[],"creatorId":"admin-id"}}],"versionMetadata":{"name":"Twenty CRM Webhook Receiver","description":null}} \ No newline at end of file