mcp-lab-agent 2.1.10 → 2.3.1
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 +103 -23
- package/dist/index.js +209 -10
- package/dist/index.js.map +1 -1
- package/learning-hub/src/server.js +6 -6
- package/package.json +3 -2
- package/slack-bot/check-config.js +11 -3
- package/slack-bot/src/config.js +22 -5
|
@@ -52,15 +52,15 @@ async function handler(req, res) {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
const url = new URL(req.url || "/", `http://${req.headers.host}`);
|
|
55
|
-
const
|
|
55
|
+
const pathname = url.pathname;
|
|
56
56
|
|
|
57
57
|
try {
|
|
58
|
-
if (
|
|
58
|
+
if (pathname === "/health") {
|
|
59
59
|
send(res, 200, { ok: true, service: "learning-hub", version: "1.0.0" });
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
if (
|
|
63
|
+
if (pathname === "/learning" && req.method === "POST") {
|
|
64
64
|
const body = await parseBody(req);
|
|
65
65
|
const learnings = body.learnings ?? (body.type ? body : null);
|
|
66
66
|
if (!learnings) {
|
|
@@ -73,7 +73,7 @@ async function handler(req, res) {
|
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
if (
|
|
76
|
+
if (pathname === "/patterns" && req.method === "GET") {
|
|
77
77
|
const framework = url.searchParams.get("framework");
|
|
78
78
|
const projectId = url.searchParams.get("projectId");
|
|
79
79
|
const limit = parseInt(url.searchParams.get("limit") || "500", 10);
|
|
@@ -82,7 +82,7 @@ async function handler(req, res) {
|
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
if (
|
|
85
|
+
if (pathname === "/" || pathname === "") {
|
|
86
86
|
const dashboardPath = path.join(__dirname, "dashboard.html");
|
|
87
87
|
if (fs.existsSync(dashboardPath)) {
|
|
88
88
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
@@ -101,7 +101,7 @@ async function handler(req, res) {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
if (
|
|
104
|
+
if (pathname === "/api") {
|
|
105
105
|
send(res, 200, {
|
|
106
106
|
name: "qa-lab-learning-hub",
|
|
107
107
|
endpoints: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-lab-agent",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.3.1",
|
|
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",
|
|
@@ -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,
|