mcp-lab-agent 2.1.6 → 2.2.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/README.md +105 -21
- package/dist/index.js +1067 -287
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/slack-bot/README.md +4 -1
- package/slack-bot/TROUBLESHOOTING.md +41 -5
- package/slack-bot/check-config.js +11 -3
- package/slack-bot/src/config.js +22 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-lab-agent",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Sistema de Inteligência em Qualidade de Software: executa, analisa, prevê, recomenda e aprende. Memória local + Learning Hub.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"test:watch": "vitest",
|
|
25
25
|
"test:coverage": "vitest run --coverage",
|
|
26
26
|
"test:report": "vitest run --reporter=default --reporter=json --outputFile=test-results/results.json",
|
|
27
|
+
"resume:html": "node curriculos/generate-pdf.mjs",
|
|
27
28
|
"prepublishOnly": "npm run build"
|
|
28
29
|
},
|
|
29
30
|
"keywords": [
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
"zod": "^3.25.0"
|
|
60
61
|
},
|
|
61
62
|
"optionalDependencies": {
|
|
62
|
-
"playwright": "^1.
|
|
63
|
+
"playwright": "^1.58.2"
|
|
63
64
|
},
|
|
64
65
|
"devDependencies": {
|
|
65
66
|
"@vitest/coverage-v8": "^2.1.0",
|
package/slack-bot/README.md
CHANGED
|
@@ -71,12 +71,15 @@ Seguindo [Creating an app from app settings](https://docs.slack.dev/app-manageme
|
|
|
71
71
|
"slack": {
|
|
72
72
|
"botToken": "xoxb-...",
|
|
73
73
|
"appToken": "xapp-...",
|
|
74
|
-
"useLocal": true
|
|
74
|
+
"useLocal": true,
|
|
75
|
+
"workDir": "/caminho/completo/para/projeto-com-testes"
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
```
|
|
79
80
|
|
|
81
|
+
> **Importante:** Com `useLocal: true`, defina `workDir` com o caminho absoluto do projeto. Caso contrário, o bot usa a pasta de onde foi iniciado e pode não encontrar os testes. Veja [TROUBLESHOOTING.md](./TROUBLESHOOTING.md#6-bot-identifica-o-projeto-mas-não-vê-os-testes).
|
|
82
|
+
|
|
80
83
|
| Credencial | Onde obter em api.slack.com |
|
|
81
84
|
|-------------|-----------------------------|
|
|
82
85
|
| `botToken` | OAuth & Permissions → OAuth Tokens → Bot User OAuth Token |
|
|
@@ -47,16 +47,52 @@ O `~/.cursor/mcp.json` precisa ter a seção `qa-lab-agent.slack`:
|
|
|
47
47
|
- `appToken` — Basic Information → App-Level Tokens (scope `connections:write`, começa com `xapp-`) — só para Socket Mode
|
|
48
48
|
- `useLocal: true` — analisa o projeto local (pasta atual) em vez de clonar um repo
|
|
49
49
|
|
|
50
|
-
### 4.
|
|
50
|
+
### 4. Bot identifica o projeto mas não vê os testes
|
|
51
|
+
|
|
52
|
+
**Causa comum:** O bot analisa a pasta de onde foi **iniciado**. Se você rodou `npx mcp-lab-agent slack-bot` de uma pasta que não é a raiz do projeto (ex.: home, ou outra pasta), ele não vai encontrar os testes.
|
|
53
|
+
|
|
54
|
+
**Solução:** Configure `workDir` no `mcp.json` com o **caminho completo** da pasta do projeto que contém os testes:
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"qa-lab-agent": {
|
|
59
|
+
"slack": {
|
|
60
|
+
"botToken": "xoxb-...",
|
|
61
|
+
"appToken": "xapp-...",
|
|
62
|
+
"useLocal": true,
|
|
63
|
+
"workDir": "/caminho/completo/para/seu-projeto-com-testes"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Exemplo no Windows: `"workDir": "C:\\Users\\SeuUsuario\\Desktop\\e2e-test-automation"`
|
|
70
|
+
Exemplo no macOS/Linux: `"workDir": "/Users/wesley/Desktop/e2e-test-automation"`
|
|
71
|
+
|
|
72
|
+
**Alternativa:** Inicie o bot **de dentro da pasta do projeto**:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
cd /caminho/para/seu-projeto-com-testes
|
|
76
|
+
npx mcp-lab-agent slack-bot
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Se os testes estão em pasta não padrão** (ex.: `cypress/e2e`, `packages/app/tests`), crie `qa-lab-agent.config.json` na raiz do projeto:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"testDirs": ["e2e", "cypress", "tests"]
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 5. Rodar o diagnóstico
|
|
51
88
|
|
|
52
89
|
```bash
|
|
53
|
-
|
|
54
|
-
npm run check
|
|
90
|
+
npm run slack-bot:check
|
|
55
91
|
```
|
|
56
92
|
|
|
57
93
|
Corrija qualquer item marcado com ❌.
|
|
58
94
|
|
|
59
|
-
###
|
|
95
|
+
### 6. Conferir se o bot está rodando
|
|
60
96
|
|
|
61
97
|
Ao subir com `npm start`, deve aparecer:
|
|
62
98
|
|
|
@@ -65,7 +101,7 @@ Ao subir com `npm start`, deve aparecer:
|
|
|
65
101
|
|
|
66
102
|
Se der erro ao iniciar, leia a mensagem — geralmente indica token inválido ou faltando.
|
|
67
103
|
|
|
68
|
-
###
|
|
104
|
+
### 7. Firewall / proxy corporativo
|
|
69
105
|
|
|
70
106
|
Em redes corporativas, às vezes o WebSocket (Socket Mode) é bloqueado. Tente:
|
|
71
107
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { config } from "dotenv";
|
|
7
7
|
import { readFileSync, existsSync } from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
9
|
+
import os from "node:os";
|
|
9
10
|
import { fileURLToPath } from "node:url";
|
|
10
11
|
|
|
11
12
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -23,11 +24,18 @@ for (const p of envPaths) {
|
|
|
23
24
|
break;
|
|
24
25
|
}
|
|
25
26
|
}
|
|
27
|
+
function expandTilde(filePath) {
|
|
28
|
+
if (!filePath || typeof filePath !== "string") return filePath;
|
|
29
|
+
if (filePath.startsWith("~/")) return path.join(os.homedir(), filePath.slice(2));
|
|
30
|
+
if (filePath === "~") return os.homedir();
|
|
31
|
+
return filePath;
|
|
32
|
+
}
|
|
26
33
|
function getMcpJsonPath() {
|
|
27
|
-
const
|
|
28
|
-
|
|
34
|
+
const envPath = process.env.QA_LAB_MCP_CONFIG;
|
|
35
|
+
if (envPath) return expandTilde(envPath);
|
|
36
|
+
return path.join(os.homedir(), ".cursor", "mcp.json");
|
|
29
37
|
}
|
|
30
|
-
const mcpPath =
|
|
38
|
+
const mcpPath = getMcpJsonPath();
|
|
31
39
|
|
|
32
40
|
console.log("\n🔧 QA Lab Slack Bot - Diagnóstico\n");
|
|
33
41
|
console.log("1. Origens de config (mcp.json ou .env):");
|
package/slack-bot/src/config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { config } from "dotenv";
|
|
2
2
|
import { readFileSync, existsSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import os from "node:os";
|
|
4
5
|
import { fileURLToPath } from "node:url";
|
|
5
6
|
|
|
6
7
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -21,14 +22,27 @@ for (const p of envPaths) {
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
function expandTilde(filePath) {
|
|
26
|
+
if (!filePath || typeof filePath !== "string") return filePath;
|
|
27
|
+
if (filePath.startsWith("~/")) {
|
|
28
|
+
return path.join(os.homedir(), filePath.slice(2));
|
|
29
|
+
}
|
|
30
|
+
if (filePath === "~") {
|
|
31
|
+
return os.homedir();
|
|
32
|
+
}
|
|
33
|
+
return filePath;
|
|
34
|
+
}
|
|
35
|
+
|
|
24
36
|
function getMcpJsonPath() {
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
|
|
37
|
+
const envPath = process.env.QA_LAB_MCP_CONFIG;
|
|
38
|
+
if (envPath) {
|
|
39
|
+
return expandTilde(envPath);
|
|
40
|
+
}
|
|
41
|
+
return path.join(os.homedir(), ".cursor", "mcp.json");
|
|
28
42
|
}
|
|
29
43
|
|
|
30
44
|
function loadMcpConfig() {
|
|
31
|
-
const mcpPath =
|
|
45
|
+
const mcpPath = getMcpJsonPath();
|
|
32
46
|
if (!mcpPath || !existsSync(mcpPath)) return null;
|
|
33
47
|
try {
|
|
34
48
|
return JSON.parse(readFileSync(mcpPath, "utf8"));
|
|
@@ -40,7 +54,10 @@ function loadMcpConfig() {
|
|
|
40
54
|
function getSlackConfigFromMcp() {
|
|
41
55
|
const mcp = loadMcpConfig();
|
|
42
56
|
const qa = mcp?.["qa-lab-agent"];
|
|
43
|
-
const slack =
|
|
57
|
+
const slack =
|
|
58
|
+
qa?.slack ||
|
|
59
|
+
mcp?.mcpServers?.["qa-lab-agent"]?.slack ||
|
|
60
|
+
mcp?.mcpServers?.["qa-lab-agent"];
|
|
44
61
|
if (!slack) return null;
|
|
45
62
|
return {
|
|
46
63
|
id: slack.id || slack.channelId,
|