diff --git a/ACCESS.md b/ACCESS.md new file mode 100644 index 0000000..fb59b10 --- /dev/null +++ b/ACCESS.md @@ -0,0 +1,128 @@ +# JIRA AI Fixer v2.0 - Credenciais e Acesso + +## 🌐 URLs + +- **Frontend:** https://jira-fixer.startdata.com.br +- **API:** https://jira-fixer.startdata.com.br/api +- **Repositório:** https://gitea.startdata.com.br/startdata/jira-ai-fixer + +## 🔐 Credenciais Padrão + +### Primeira vez (criar conta): +```bash +POST https://jira-fixer.startdata.com.br/api/auth/register +{ + "email": "admin@startdata.com.br", + "password": "JiraFixer2026!", + "name": "Admin User" +} +``` + +### Login: +```bash +POST https://jira-fixer.startdata.com.br/api/auth/login +{ + "email": "admin@startdata.com.br", + "password": "JiraFixer2026!" +} +``` + +**Retorno:** `{ "access_token": "..." }` + +### Usar token: +```bash +curl -H "Authorization: Bearer YOUR_TOKEN" https://jira-fixer.startdata.com.br/api/issues +``` + +## 📊 Banco de Dados + +- **Type:** PostgreSQL 15 +- **Host:** postgres_database (internal Docker network) +- **Port:** 5432 +- **Database:** jira_fixer_v2 +- **User:** postgres +- **Password:** postgres + +**Connection string:** +``` +postgresql+asyncpg://postgres:postgres@postgres_database:5432/jira_fixer_v2 +``` + +## 🧪 Teste End-to-End + +### Cenário: Bug no COBOL → Análise AI → Fix automático + +1. **Repo de teste:** https://gitea.startdata.com.br/startdata/cobol-sample-app +2. **Bug introduzido:** `src/cobol/VALIDATE.CBL` - aceita cartões com 10+ dígitos ao invés de exatamente 16 +3. **Ticket criado:** TicketHub SUPP-6 + +### Fluxo esperado: + +```bash +# 1. Criar issue no JIRA Fixer +curl -X POST https://jira-fixer.startdata.com.br/api/issues \ + -H "Authorization: Bearer $TOKEN" \ + -H "Content-Type: application/json" \ + -d '{ + "title": "Card validation accepts invalid card numbers", + "description": "VALIDATE.CBL accepts cards with >= 10 digits instead of exactly 16", + "source": "tickethub", + "external_key": "SUPP-6", + "external_url": "https://tickethub.startdata.com.br/tickets/6", + "priority": "high" + }' + +# 2. AI analisa automaticamente (background task) +# - Identifica arquivo: src/cobol/VALIDATE.CBL +# - Root cause: >= 10 ao invés de = 16 +# - Confiança: ~95% + +# 3. Se confiança >= 70%, cria PR automaticamente +# - Fork/branch: fix/SUPP-6-auto-fix +# - Commit: correção da validação +# - PR no Gitea + +# 4. Atualiza ticket TicketHub +PATCH https://tickethub.startdata.com.br/api/tickets/6 \ + -d '{ + "status": "in_progress", + "description": "AI analysis complete. PR created: [link]" + }' +``` + +## ⚙️ Integrações + +### TicketHub +- **URL:** https://tickethub.startdata.com.br +- **Webhook:** `https://jira-fixer.startdata.com.br/api/webhooks/tickethub` +- **Project:** SUPP (ID: 1) + +### Gitea +- **URL:** https://gitea.startdata.com.br +- **Token:** (configurar em Settings → API Keys) +- **Repo de teste:** startdata/cobol-sample-app + +### AI Model +- **Provider:** OpenRouter +- **Model:** claude-3.5-sonnet / llama-3.3-70b-instruct +- **API Key:** (variável de ambiente OPENROUTER_API_KEY) + +## 🚨 Status Atual (2026-02-18) + +**Frontend:** ✅ Deployado e funcional +**Backend API:** ⚠️ Stack precisa ser atualizado para incluir serviço API Python + +### Próximo passo para completar deploy: +1. Atualizar stack 308 para incluir serviço `api` (Python FastAPI) +2. Configurar DB connection string +3. Configurar OPENROUTER_API_KEY +4. Testar registro/login +5. Executar teste end-to-end + +## 📝 Notas + +- Frontend é SPA React, serve via nginx +- Backend é FastAPI async com PostgreSQL +- Análise AI roda em background tasks +- PR creation usa Gitea API +- Webhooks bidirecional com TicketHub