@testingbot/mcp-server 1.0.0 → 1.0.2
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 +114 -7
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +31 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/constants.d.ts +32 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +32 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/credentials.d.ts +19 -0
- package/dist/lib/credentials.d.ts.map +1 -0
- package/dist/lib/credentials.js +128 -0
- package/dist/lib/credentials.js.map +1 -0
- package/dist/lib/error.d.ts +14 -0
- package/dist/lib/error.d.ts.map +1 -0
- package/dist/lib/error.js +27 -0
- package/dist/lib/error.js.map +1 -0
- package/dist/lib/get-auth.d.ts +6 -0
- package/dist/lib/get-auth.d.ts.map +1 -0
- package/dist/lib/get-auth.js +7 -0
- package/dist/lib/get-auth.js.map +1 -0
- package/dist/lib/logger.d.ts +4 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +77 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/types.d.ts +70 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils.d.ts +12 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +40 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/server-factory.d.ts +33 -0
- package/dist/server-factory.d.ts.map +1 -0
- package/dist/server-factory.js +224 -0
- package/dist/server-factory.js.map +1 -0
- package/dist/silence-wdio.d.ts +2 -0
- package/dist/silence-wdio.d.ts.map +1 -0
- package/dist/silence-wdio.js +17 -0
- package/dist/silence-wdio.js.map +1 -0
- package/dist/tools/auth.d.ts +43 -0
- package/dist/tools/auth.d.ts.map +1 -0
- package/dist/tools/auth.js +571 -0
- package/dist/tools/auth.js.map +1 -0
- package/dist/tools/browsers.d.ts +3 -0
- package/dist/tools/browsers.d.ts.map +1 -0
- package/dist/tools/browsers.js +74 -0
- package/dist/tools/browsers.js.map +1 -0
- package/dist/tools/builds.d.ts +3 -0
- package/dist/tools/builds.d.ts.map +1 -0
- package/dist/tools/builds.js +115 -0
- package/dist/tools/builds.js.map +1 -0
- package/dist/tools/cdp.d.ts +3 -0
- package/dist/tools/cdp.d.ts.map +1 -0
- package/dist/tools/cdp.js +78 -0
- package/dist/tools/cdp.js.map +1 -0
- package/dist/tools/live.d.ts +3 -0
- package/dist/tools/live.d.ts.map +1 -0
- package/dist/tools/live.js +221 -0
- package/dist/tools/live.js.map +1 -0
- package/dist/tools/logs.d.ts +3 -0
- package/dist/tools/logs.d.ts.map +1 -0
- package/dist/tools/logs.js +135 -0
- package/dist/tools/logs.js.map +1 -0
- package/dist/tools/project.d.ts +16 -0
- package/dist/tools/project.d.ts.map +1 -0
- package/dist/tools/project.js +457 -0
- package/dist/tools/project.js.map +1 -0
- package/dist/tools/screenshots.d.ts +3 -0
- package/dist/tools/screenshots.d.ts.map +1 -0
- package/dist/tools/screenshots.js +132 -0
- package/dist/tools/screenshots.js.map +1 -0
- package/dist/tools/storage.d.ts +3 -0
- package/dist/tools/storage.d.ts.map +1 -0
- package/dist/tools/storage.js +200 -0
- package/dist/tools/storage.js.map +1 -0
- package/dist/tools/team.d.ts +3 -0
- package/dist/tools/team.d.ts.map +1 -0
- package/dist/tools/team.js +171 -0
- package/dist/tools/team.js.map +1 -0
- package/dist/tools/tests.d.ts +3 -0
- package/dist/tools/tests.d.ts.map +1 -0
- package/dist/tools/tests.js +309 -0
- package/dist/tools/tests.js.map +1 -0
- package/dist/tools/tunnels.d.ts +3 -0
- package/dist/tools/tunnels.d.ts.map +1 -0
- package/dist/tools/tunnels.js +74 -0
- package/dist/tools/tunnels.js.map +1 -0
- package/dist/tools/user.d.ts +3 -0
- package/dist/tools/user.d.ts.map +1 -0
- package/dist/tools/user.js +83 -0
- package/dist/tools/user.js.map +1 -0
- package/package.json +10 -3
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { handleMCPError, sanitizeSessionId } from "../lib/utils.js";
|
|
3
|
+
import logger from "../lib/logger.js";
|
|
4
|
+
const SUPPORTED_LOG_TYPES = ["selenium", "browser", "chrome", "vm", "appium"];
|
|
5
|
+
// Heuristic: classify a single log line as failure-relevant. Conservative on
|
|
6
|
+
// false positives (e.g. ignores HTTP 200 / "OK") and matches stack-trace
|
|
7
|
+
// shapes from Java, Python, JS, and Ruby drivers.
|
|
8
|
+
const FAILURE_PATTERN = /\b(error|exception|failed|failure|traceback|stacktrace|fatal|panic|assertion|timeout|crash|refused|unreachable)\b|\bHTTP\/\S+\s+(4\d\d|5\d\d)\b|\bat [\w$.<>]+\([^)]+:\d+/i;
|
|
9
|
+
function isFailureLine(line) {
|
|
10
|
+
return FAILURE_PATTERN.test(line);
|
|
11
|
+
}
|
|
12
|
+
async function fetchLog(url, maxBytes, signal) {
|
|
13
|
+
const response = await fetch(url, { signal });
|
|
14
|
+
if (!response.ok) {
|
|
15
|
+
throw new Error(`HTTP ${response.status} fetching log`);
|
|
16
|
+
}
|
|
17
|
+
const text = await response.text();
|
|
18
|
+
if (text.length <= maxBytes)
|
|
19
|
+
return text;
|
|
20
|
+
// Keep the tail — failure context lives near the end of a log file.
|
|
21
|
+
return `… (truncated ${text.length - maxBytes} bytes) …\n` + text.slice(text.length - maxBytes);
|
|
22
|
+
}
|
|
23
|
+
function selectLines(content, failuresOnly) {
|
|
24
|
+
if (!failuresOnly)
|
|
25
|
+
return content;
|
|
26
|
+
const lines = content.split(/\r?\n/);
|
|
27
|
+
const matches = [];
|
|
28
|
+
for (let i = 0; i < lines.length; i++) {
|
|
29
|
+
if (isFailureLine(lines[i])) {
|
|
30
|
+
// Include 1 line of context above and below for readability.
|
|
31
|
+
const start = Math.max(0, i - 1);
|
|
32
|
+
const end = Math.min(lines.length, i + 2);
|
|
33
|
+
matches.push(lines.slice(start, end).join("\n"));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (matches.length === 0)
|
|
37
|
+
return "(no failure-relevant lines matched)";
|
|
38
|
+
// De-duplicate adjacent overlapping context windows.
|
|
39
|
+
return [...new Set(matches)].join("\n---\n");
|
|
40
|
+
}
|
|
41
|
+
export default function addLogTools(server, testingBotApi, _config) {
|
|
42
|
+
const tools = {};
|
|
43
|
+
tools.getFailureLogs = server.tool("getFailureLogs", "Fetch and return session log file content (selenium, browser, chrome, vm, appium) for a test by session ID. Use this to debug failures — pass failuresOnly=true to extract only error/exception/stack-trace lines.", {
|
|
44
|
+
sessionId: z.string().min(1).describe("The session ID of the test"),
|
|
45
|
+
logTypes: z
|
|
46
|
+
.array(z.enum(SUPPORTED_LOG_TYPES))
|
|
47
|
+
.optional()
|
|
48
|
+
.describe(`Which log types to fetch. Defaults to every type available on the test. Valid: ${SUPPORTED_LOG_TYPES.join(", ")}.`),
|
|
49
|
+
failuresOnly: z
|
|
50
|
+
.union([z.boolean(), z.string().transform((s) => s === "true")])
|
|
51
|
+
.pipe(z.boolean())
|
|
52
|
+
.optional()
|
|
53
|
+
.default(false)
|
|
54
|
+
.describe("If true, only return lines that match error/exception/stack-trace patterns (plus 1 line of context above/below)."),
|
|
55
|
+
maxBytesPerLog: z
|
|
56
|
+
.union([z.number(), z.string().transform(Number)])
|
|
57
|
+
.pipe(z.number().int().min(1000).max(1_000_000))
|
|
58
|
+
.optional()
|
|
59
|
+
.default(50_000)
|
|
60
|
+
.describe("Truncate each log to the last N bytes (default 50000, max 1000000). Failure context typically lives near the end."),
|
|
61
|
+
timeoutMs: z
|
|
62
|
+
.union([z.number(), z.string().transform(Number)])
|
|
63
|
+
.pipe(z.number().int().min(1000).max(60_000))
|
|
64
|
+
.optional()
|
|
65
|
+
.default(15_000)
|
|
66
|
+
.describe("Per-log fetch timeout in milliseconds (default 15000)."),
|
|
67
|
+
}, async (args) => {
|
|
68
|
+
try {
|
|
69
|
+
const sessionId = sanitizeSessionId(args.sessionId);
|
|
70
|
+
if (!sessionId) {
|
|
71
|
+
throw new Error("Session ID is empty after sanitization");
|
|
72
|
+
}
|
|
73
|
+
logger.info({ sessionId, logTypes: args.logTypes, failuresOnly: args.failuresOnly }, "Fetching failure logs");
|
|
74
|
+
const test = await testingBotApi.getTestDetails(sessionId);
|
|
75
|
+
const logMap = test?.logs && typeof test.logs === "object" ? test.logs : {};
|
|
76
|
+
const requested = args.logTypes && args.logTypes.length > 0
|
|
77
|
+
? args.logTypes
|
|
78
|
+
: SUPPORTED_LOG_TYPES.filter((t) => logMap[t]);
|
|
79
|
+
if (requested.length === 0) {
|
|
80
|
+
return {
|
|
81
|
+
content: [
|
|
82
|
+
{
|
|
83
|
+
type: "text",
|
|
84
|
+
text: `## Failure Logs: ${sessionId}\n\nNo log URLs available for this session. Logs may still be processing, or the test never produced them.\n`,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const maxBytes = args.maxBytesPerLog ?? 50_000;
|
|
90
|
+
const failuresOnly = args.failuresOnly ?? false;
|
|
91
|
+
const timeoutMs = args.timeoutMs ?? 15_000;
|
|
92
|
+
const sections = await Promise.all(requested.map(async (logType) => {
|
|
93
|
+
const url = logMap[logType];
|
|
94
|
+
if (!url)
|
|
95
|
+
return { logType, status: "missing" };
|
|
96
|
+
const controller = new AbortController();
|
|
97
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
98
|
+
try {
|
|
99
|
+
const raw = await fetchLog(url, maxBytes, controller.signal);
|
|
100
|
+
const filtered = selectLines(raw, failuresOnly);
|
|
101
|
+
return { logType, status: "ok", url, content: filtered };
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
105
|
+
return { logType, status: "error", url, error: message };
|
|
106
|
+
}
|
|
107
|
+
finally {
|
|
108
|
+
clearTimeout(timer);
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
111
|
+
let output = `## Failure Logs: ${sessionId}\n\n`;
|
|
112
|
+
output += `**Mode**: ${failuresOnly ? "failures only" : "full"} · **Max bytes/log**: ${maxBytes}\n\n`;
|
|
113
|
+
for (const section of sections) {
|
|
114
|
+
output += `### ${section.logType}\n`;
|
|
115
|
+
if (section.status === "missing") {
|
|
116
|
+
output += "_not available for this session_\n\n";
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (section.status === "error") {
|
|
120
|
+
output += `_fetch failed: ${section.error}_\n_url: ${section.url}_\n\n`;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
output += `**Source**: ${section.url}\n\n\`\`\`\n${section.content}\n\`\`\`\n\n`;
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
content: [{ type: "text", text: output }],
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
return handleMCPError("getFailureLogs", error);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
return tools;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=logs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/tools/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAU,CAAC;AAGvF,6EAA6E;AAC7E,yEAAyE;AACzE,kDAAkD;AAClD,MAAM,eAAe,GACnB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OAAO,cAAc,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TestingBotConfig } from "../lib/types.js";
|
|
2
|
+
type Framework = "playwright" | "cypress" | "webdriverio" | "selenium-js" | "nightwatch" | "puppeteer" | "jest" | "mocha" | "vitest" | "unknown";
|
|
3
|
+
type Language = "javascript" | "typescript" | "python" | "java" | "ruby" | "unknown";
|
|
4
|
+
interface DetectionResult {
|
|
5
|
+
projectRoot: string;
|
|
6
|
+
language: Language;
|
|
7
|
+
framework: Framework;
|
|
8
|
+
testFileGlobs: string[];
|
|
9
|
+
testDirs: string[];
|
|
10
|
+
packageManager: "npm" | "yarn" | "pnpm" | null;
|
|
11
|
+
detectedFrom: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function detectFramework(projectRoot: string): DetectionResult;
|
|
14
|
+
export default function addProjectTools(server: any, _testingBotApi: any, _config: TestingBotConfig): Record<string, any>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/tools/project.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAQnD,KAAK,SAAS,GACV,YAAY,GACZ,SAAS,GACT,aAAa,GACb,aAAa,GACb,YAAY,GACZ,WAAW,GACX,MAAM,GACN,OAAO,GACP,QAAQ,GACR,SAAS,CAAC;AAEd,KAAK,QAAQ,GAAG,YAAY,GAAG,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAErF,UAAU,eAAe;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC/C,YAAY,EAAE,MAAM,CAAC;CACtB;AAsJD,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,CAiCpE;AAwLD,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,MAAM,EAAE,GAAG,EACX,cAAc,EAAE,GAAG,EACnB,OAAO,EAAE,gBAAgB,uBA6H1B"}
|
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import { handleMCPError } from "../lib/utils.js";
|
|
5
|
+
import logger from "../lib/logger.js";
|
|
6
|
+
const FRAMEWORK_PACKAGE_HINTS = [
|
|
7
|
+
{ pkg: "@playwright/test", framework: "playwright" },
|
|
8
|
+
{ pkg: "playwright", framework: "playwright" },
|
|
9
|
+
{ pkg: "cypress", framework: "cypress" },
|
|
10
|
+
{ pkg: "webdriverio", framework: "webdriverio" },
|
|
11
|
+
{ pkg: "@wdio/cli", framework: "webdriverio" },
|
|
12
|
+
{ pkg: "nightwatch", framework: "nightwatch" },
|
|
13
|
+
{ pkg: "selenium-webdriver", framework: "selenium-js" },
|
|
14
|
+
{ pkg: "puppeteer", framework: "puppeteer" },
|
|
15
|
+
{ pkg: "vitest", framework: "vitest" },
|
|
16
|
+
{ pkg: "jest", framework: "jest" },
|
|
17
|
+
{ pkg: "mocha", framework: "mocha" },
|
|
18
|
+
];
|
|
19
|
+
const FRAMEWORK_DEFAULTS = {
|
|
20
|
+
playwright: {
|
|
21
|
+
globs: ["**/*.spec.ts", "**/*.spec.js", "**/*.test.ts", "**/*.test.js"],
|
|
22
|
+
dirs: ["tests", "e2e", "playwright"],
|
|
23
|
+
},
|
|
24
|
+
cypress: { globs: ["**/*.cy.ts", "**/*.cy.js"], dirs: ["cypress/e2e", "cypress/integration"] },
|
|
25
|
+
webdriverio: {
|
|
26
|
+
globs: ["**/*.e2e.ts", "**/*.e2e.js", "**/*.spec.ts", "**/*.spec.js"],
|
|
27
|
+
dirs: ["test", "tests", "e2e"],
|
|
28
|
+
},
|
|
29
|
+
"selenium-js": {
|
|
30
|
+
globs: ["**/*.test.js", "**/*.test.ts", "**/*.spec.js", "**/*.spec.ts"],
|
|
31
|
+
dirs: ["test", "tests"],
|
|
32
|
+
},
|
|
33
|
+
nightwatch: { globs: ["**/*.js", "**/*.ts"], dirs: ["tests", "nightwatch/e2e"] },
|
|
34
|
+
puppeteer: { globs: ["**/*.test.js", "**/*.test.ts"], dirs: ["test", "tests"] },
|
|
35
|
+
jest: {
|
|
36
|
+
globs: ["**/*.test.ts", "**/*.test.js", "**/*.spec.ts", "**/*.spec.js"],
|
|
37
|
+
dirs: ["__tests__", "test", "tests"],
|
|
38
|
+
},
|
|
39
|
+
mocha: { globs: ["**/*.test.js", "**/*.spec.js"], dirs: ["test"] },
|
|
40
|
+
vitest: { globs: ["**/*.test.ts", "**/*.test.js"], dirs: ["test", "tests"] },
|
|
41
|
+
unknown: { globs: ["**/*.test.*", "**/*.spec.*"], dirs: ["test", "tests"] },
|
|
42
|
+
};
|
|
43
|
+
function safeReadJson(filePath) {
|
|
44
|
+
try {
|
|
45
|
+
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function detectPackageManager(projectRoot) {
|
|
52
|
+
if (fs.existsSync(path.join(projectRoot, "pnpm-lock.yaml")))
|
|
53
|
+
return "pnpm";
|
|
54
|
+
if (fs.existsSync(path.join(projectRoot, "yarn.lock")))
|
|
55
|
+
return "yarn";
|
|
56
|
+
if (fs.existsSync(path.join(projectRoot, "package-lock.json")))
|
|
57
|
+
return "npm";
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
function detectFromPython(projectRoot) {
|
|
61
|
+
if (!fs.existsSync(path.join(projectRoot, "requirements.txt")) &&
|
|
62
|
+
!fs.existsSync(path.join(projectRoot, "pyproject.toml")) &&
|
|
63
|
+
!fs.existsSync(path.join(projectRoot, "Pipfile"))) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
// Cheap content match — agents will use the result as a hint, not gospel.
|
|
67
|
+
let content = "";
|
|
68
|
+
for (const f of ["requirements.txt", "pyproject.toml", "Pipfile"]) {
|
|
69
|
+
const p = path.join(projectRoot, f);
|
|
70
|
+
if (fs.existsSync(p))
|
|
71
|
+
content += fs.readFileSync(p, "utf8") + "\n";
|
|
72
|
+
}
|
|
73
|
+
let framework = "unknown";
|
|
74
|
+
if (/playwright/i.test(content))
|
|
75
|
+
framework = "playwright";
|
|
76
|
+
else if (/selenium/i.test(content))
|
|
77
|
+
framework = "selenium-js";
|
|
78
|
+
return {
|
|
79
|
+
language: "python",
|
|
80
|
+
framework,
|
|
81
|
+
testFileGlobs: ["**/test_*.py", "**/*_test.py"],
|
|
82
|
+
testDirs: ["tests", "test"],
|
|
83
|
+
detectedFrom: "requirements.txt / pyproject.toml",
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function detectFromJava(projectRoot) {
|
|
87
|
+
const pom = path.join(projectRoot, "pom.xml");
|
|
88
|
+
const gradle = path.join(projectRoot, "build.gradle");
|
|
89
|
+
const gradleKts = path.join(projectRoot, "build.gradle.kts");
|
|
90
|
+
let buildFile = null;
|
|
91
|
+
if (fs.existsSync(pom))
|
|
92
|
+
buildFile = pom;
|
|
93
|
+
else if (fs.existsSync(gradle))
|
|
94
|
+
buildFile = gradle;
|
|
95
|
+
else if (fs.existsSync(gradleKts))
|
|
96
|
+
buildFile = gradleKts;
|
|
97
|
+
if (!buildFile)
|
|
98
|
+
return null;
|
|
99
|
+
const content = fs.readFileSync(buildFile, "utf8");
|
|
100
|
+
let framework = "unknown";
|
|
101
|
+
if (/selenium/i.test(content))
|
|
102
|
+
framework = "selenium-js";
|
|
103
|
+
else if (/playwright/i.test(content))
|
|
104
|
+
framework = "playwright";
|
|
105
|
+
return {
|
|
106
|
+
language: "java",
|
|
107
|
+
framework,
|
|
108
|
+
testFileGlobs: ["**/*Test.java", "**/*IT.java", "**/Test*.java"],
|
|
109
|
+
testDirs: ["src/test/java"],
|
|
110
|
+
detectedFrom: path.basename(buildFile),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function detectFromRuby(projectRoot) {
|
|
114
|
+
const gemfile = path.join(projectRoot, "Gemfile");
|
|
115
|
+
if (!fs.existsSync(gemfile))
|
|
116
|
+
return null;
|
|
117
|
+
const content = fs.readFileSync(gemfile, "utf8");
|
|
118
|
+
let framework = "unknown";
|
|
119
|
+
if (/selenium-webdriver/i.test(content))
|
|
120
|
+
framework = "selenium-js";
|
|
121
|
+
return {
|
|
122
|
+
language: "ruby",
|
|
123
|
+
framework,
|
|
124
|
+
testFileGlobs: ["**/*_spec.rb", "**/*_test.rb"],
|
|
125
|
+
testDirs: ["spec", "test"],
|
|
126
|
+
detectedFrom: "Gemfile",
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function detectFromNode(projectRoot) {
|
|
130
|
+
const pkg = safeReadJson(path.join(projectRoot, "package.json"));
|
|
131
|
+
if (!pkg)
|
|
132
|
+
return null;
|
|
133
|
+
const deps = {
|
|
134
|
+
...(pkg.dependencies || {}),
|
|
135
|
+
...(pkg.devDependencies || {}),
|
|
136
|
+
};
|
|
137
|
+
let framework = "unknown";
|
|
138
|
+
for (const hint of FRAMEWORK_PACKAGE_HINTS) {
|
|
139
|
+
if (deps[hint.pkg]) {
|
|
140
|
+
framework = hint.framework;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const isTs = !!deps["typescript"] || fs.existsSync(path.join(projectRoot, "tsconfig.json"));
|
|
145
|
+
const defaults = FRAMEWORK_DEFAULTS[framework];
|
|
146
|
+
return {
|
|
147
|
+
language: isTs ? "typescript" : "javascript",
|
|
148
|
+
framework,
|
|
149
|
+
testFileGlobs: defaults.globs,
|
|
150
|
+
testDirs: defaults.dirs,
|
|
151
|
+
detectedFrom: "package.json",
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
export function detectFramework(projectRoot) {
|
|
155
|
+
const resolved = path.resolve(projectRoot);
|
|
156
|
+
if (!fs.existsSync(resolved) || !fs.statSync(resolved).isDirectory()) {
|
|
157
|
+
throw new Error(`Project root does not exist or is not a directory: ${resolved}`);
|
|
158
|
+
}
|
|
159
|
+
const node = detectFromNode(resolved);
|
|
160
|
+
const python = !node ? detectFromPython(resolved) : null;
|
|
161
|
+
const java = !node && !python ? detectFromJava(resolved) : null;
|
|
162
|
+
const ruby = !node && !python && !java ? detectFromRuby(resolved) : null;
|
|
163
|
+
const detected = node || python || java || ruby;
|
|
164
|
+
if (!detected) {
|
|
165
|
+
return {
|
|
166
|
+
projectRoot: resolved,
|
|
167
|
+
language: "unknown",
|
|
168
|
+
framework: "unknown",
|
|
169
|
+
testFileGlobs: FRAMEWORK_DEFAULTS.unknown.globs,
|
|
170
|
+
testDirs: FRAMEWORK_DEFAULTS.unknown.dirs,
|
|
171
|
+
packageManager: detectPackageManager(resolved),
|
|
172
|
+
detectedFrom: "no manifest found",
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
projectRoot: resolved,
|
|
177
|
+
language: detected.language,
|
|
178
|
+
framework: detected.framework,
|
|
179
|
+
testFileGlobs: detected.testFileGlobs,
|
|
180
|
+
testDirs: detected.testDirs,
|
|
181
|
+
packageManager: detectPackageManager(resolved),
|
|
182
|
+
detectedFrom: detected.detectedFrom,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
// =============================================================================
|
|
186
|
+
// listTestFiles — walk the detected test dirs
|
|
187
|
+
// =============================================================================
|
|
188
|
+
const IGNORED_DIRS = new Set([
|
|
189
|
+
"node_modules",
|
|
190
|
+
".git",
|
|
191
|
+
"dist",
|
|
192
|
+
"build",
|
|
193
|
+
"out",
|
|
194
|
+
".next",
|
|
195
|
+
"coverage",
|
|
196
|
+
".venv",
|
|
197
|
+
"venv",
|
|
198
|
+
"__pycache__",
|
|
199
|
+
"target",
|
|
200
|
+
".gradle",
|
|
201
|
+
".idea",
|
|
202
|
+
".vscode",
|
|
203
|
+
]);
|
|
204
|
+
function* walk(dir, maxDepth, depth = 0) {
|
|
205
|
+
if (depth > maxDepth)
|
|
206
|
+
return;
|
|
207
|
+
let entries;
|
|
208
|
+
try {
|
|
209
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
for (const entry of entries) {
|
|
215
|
+
if (entry.name.startsWith(".") && entry.name !== "." && entry.name !== "..")
|
|
216
|
+
continue;
|
|
217
|
+
if (IGNORED_DIRS.has(entry.name))
|
|
218
|
+
continue;
|
|
219
|
+
const full = path.join(dir, entry.name);
|
|
220
|
+
if (entry.isDirectory()) {
|
|
221
|
+
yield* walk(full, maxDepth, depth + 1);
|
|
222
|
+
}
|
|
223
|
+
else if (entry.isFile()) {
|
|
224
|
+
yield full;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function matchesAnyGlob(file, globs) {
|
|
229
|
+
// Translate a minimal glob subset (`**`, `*`, `?`, `.`) into a RegExp.
|
|
230
|
+
return globs.some((g) => {
|
|
231
|
+
const re = new RegExp("^" +
|
|
232
|
+
g
|
|
233
|
+
.replace(/[.+^${}()|[\]\\]/g, "\\$&")
|
|
234
|
+
.replace(/\*\*/g, "::DOUBLESTAR::")
|
|
235
|
+
.replace(/\*/g, "[^/]*")
|
|
236
|
+
.replace(/\?/g, ".")
|
|
237
|
+
.replace(/::DOUBLESTAR::/g, ".*") +
|
|
238
|
+
"$");
|
|
239
|
+
return re.test(file.replace(/\\/g, "/"));
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
// =============================================================================
|
|
243
|
+
// SDK config snippets
|
|
244
|
+
// =============================================================================
|
|
245
|
+
function configSnippet(framework, language) {
|
|
246
|
+
if (framework === "playwright") {
|
|
247
|
+
return [
|
|
248
|
+
"```typescript",
|
|
249
|
+
"// playwright.config.ts — TestingBot connection",
|
|
250
|
+
"import { defineConfig } from '@playwright/test';",
|
|
251
|
+
"",
|
|
252
|
+
"const wsEndpoint = `wss://cloud.testingbot.com/playwright?` + new URLSearchParams({",
|
|
253
|
+
" key: process.env.TESTINGBOT_KEY!,",
|
|
254
|
+
" secret: process.env.TESTINGBOT_SECRET!,",
|
|
255
|
+
" browserName: 'chrome',",
|
|
256
|
+
" browserVersion: 'latest',",
|
|
257
|
+
" os: 'WIN11',",
|
|
258
|
+
"}).toString();",
|
|
259
|
+
"",
|
|
260
|
+
"export default defineConfig({",
|
|
261
|
+
" use: { connectOptions: { wsEndpoint } },",
|
|
262
|
+
"});",
|
|
263
|
+
"```",
|
|
264
|
+
].join("\n");
|
|
265
|
+
}
|
|
266
|
+
if (framework === "selenium-js") {
|
|
267
|
+
return [
|
|
268
|
+
"```" + (language === "typescript" ? "typescript" : "javascript"),
|
|
269
|
+
"// selenium-webdriver — TestingBot remote driver",
|
|
270
|
+
"const { Builder } = require('selenium-webdriver');",
|
|
271
|
+
"",
|
|
272
|
+
"const driver = await new Builder()",
|
|
273
|
+
" .usingServer(`https://${process.env.TESTINGBOT_KEY}:${process.env.TESTINGBOT_SECRET}@hub.testingbot.com/wd/hub`)",
|
|
274
|
+
" .withCapabilities({",
|
|
275
|
+
" browserName: 'chrome',",
|
|
276
|
+
" browserVersion: 'latest',",
|
|
277
|
+
" platformName: 'Windows 11',",
|
|
278
|
+
" 'tb:options': { name: 'My Test', build: 'build-1' },",
|
|
279
|
+
" })",
|
|
280
|
+
" .build();",
|
|
281
|
+
"```",
|
|
282
|
+
].join("\n");
|
|
283
|
+
}
|
|
284
|
+
if (framework === "webdriverio") {
|
|
285
|
+
return [
|
|
286
|
+
"```javascript",
|
|
287
|
+
"// wdio.conf.js — TestingBot service",
|
|
288
|
+
"exports.config = {",
|
|
289
|
+
" user: process.env.TESTINGBOT_KEY,",
|
|
290
|
+
" key: process.env.TESTINGBOT_SECRET,",
|
|
291
|
+
" hostname: 'hub.testingbot.com',",
|
|
292
|
+
" port: 443,",
|
|
293
|
+
" path: '/wd/hub',",
|
|
294
|
+
" protocol: 'https',",
|
|
295
|
+
" services: ['testingbot'],",
|
|
296
|
+
" capabilities: [{ browserName: 'chrome', browserVersion: 'latest', platformName: 'Windows 11' }],",
|
|
297
|
+
"};",
|
|
298
|
+
"```",
|
|
299
|
+
].join("\n");
|
|
300
|
+
}
|
|
301
|
+
if (framework === "cypress") {
|
|
302
|
+
return [
|
|
303
|
+
"Cypress runs on TestingBot via the [Cypress add-on](https://testingbot.com/support/cypress).",
|
|
304
|
+
"After running `npm install -g testingbot-cypress-cli`, kick off a run with:",
|
|
305
|
+
"```bash",
|
|
306
|
+
"testingbot-cypress run \\\\",
|
|
307
|
+
" --key $TESTINGBOT_KEY \\\\",
|
|
308
|
+
" --secret $TESTINGBOT_SECRET \\\\",
|
|
309
|
+
" --browser chrome",
|
|
310
|
+
"```",
|
|
311
|
+
].join("\n");
|
|
312
|
+
}
|
|
313
|
+
if (framework === "puppeteer") {
|
|
314
|
+
return [
|
|
315
|
+
"```javascript",
|
|
316
|
+
"// Puppeteer — connect to TestingBot",
|
|
317
|
+
"const puppeteer = require('puppeteer-core');",
|
|
318
|
+
"const browser = await puppeteer.connect({",
|
|
319
|
+
" browserWSEndpoint: `wss://cloud.testingbot.com/puppeteer?key=${process.env.TESTINGBOT_KEY}&secret=${process.env.TESTINGBOT_SECRET}&browserName=chrome&browserVersion=latest`,",
|
|
320
|
+
"});",
|
|
321
|
+
"```",
|
|
322
|
+
].join("\n");
|
|
323
|
+
}
|
|
324
|
+
if (framework === "nightwatch") {
|
|
325
|
+
return [
|
|
326
|
+
"```javascript",
|
|
327
|
+
"// nightwatch.conf.js — TestingBot environment",
|
|
328
|
+
"module.exports = {",
|
|
329
|
+
" test_settings: {",
|
|
330
|
+
" testingbot: {",
|
|
331
|
+
" selenium: { host: 'hub.testingbot.com', port: 443 },",
|
|
332
|
+
" username: process.env.TESTINGBOT_KEY,",
|
|
333
|
+
" access_key: process.env.TESTINGBOT_SECRET,",
|
|
334
|
+
" desiredCapabilities: { browserName: 'chrome', browserVersion: 'latest', platformName: 'Windows 11' },",
|
|
335
|
+
" },",
|
|
336
|
+
" },",
|
|
337
|
+
"};",
|
|
338
|
+
"```",
|
|
339
|
+
].join("\n");
|
|
340
|
+
}
|
|
341
|
+
return [
|
|
342
|
+
"No first-class TestingBot integration auto-detected.",
|
|
343
|
+
"General pattern: point your driver at `https://hub.testingbot.com/wd/hub` (Selenium),",
|
|
344
|
+
"or use the wss endpoints at `wss://cloud.testingbot.com/{playwright,puppeteer}` for browser-protocol clients.",
|
|
345
|
+
"See https://testingbot.com/support for framework-specific guides.",
|
|
346
|
+
].join("\n");
|
|
347
|
+
}
|
|
348
|
+
function installCommand(framework, packageManager) {
|
|
349
|
+
const pm = packageManager || "npm";
|
|
350
|
+
const installCmd = pm === "yarn" ? "yarn add --dev" : pm === "pnpm" ? "pnpm add -D" : "npm install --save-dev";
|
|
351
|
+
if (framework === "webdriverio")
|
|
352
|
+
return `${installCmd} @wdio/testingbot-service`;
|
|
353
|
+
if (framework === "cypress")
|
|
354
|
+
return `npm install -g testingbot-cypress-cli`;
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
// =============================================================================
|
|
358
|
+
// Tool registration
|
|
359
|
+
// =============================================================================
|
|
360
|
+
export default function addProjectTools(server, _testingBotApi, _config) {
|
|
361
|
+
const tools = {};
|
|
362
|
+
tools.listTestFiles = server.tool("listTestFiles", "Scan a project directory and return test files for the detected framework. Read-only — never modifies files.", {
|
|
363
|
+
projectRoot: z.string().min(1).describe("Absolute path to the project root to scan."),
|
|
364
|
+
maxDepth: z
|
|
365
|
+
.union([z.number(), z.string().transform(Number)])
|
|
366
|
+
.pipe(z.number().int().min(1).max(15))
|
|
367
|
+
.optional()
|
|
368
|
+
.default(8)
|
|
369
|
+
.describe("Max directory depth to walk (default 8)."),
|
|
370
|
+
maxResults: z
|
|
371
|
+
.union([z.number(), z.string().transform(Number)])
|
|
372
|
+
.pipe(z.number().int().min(1).max(2000))
|
|
373
|
+
.optional()
|
|
374
|
+
.default(200)
|
|
375
|
+
.describe("Cap on returned file paths (default 200, max 2000)."),
|
|
376
|
+
}, async (args) => {
|
|
377
|
+
try {
|
|
378
|
+
const detection = detectFramework(args.projectRoot);
|
|
379
|
+
const maxDepth = args.maxDepth ?? 8;
|
|
380
|
+
const maxResults = args.maxResults ?? 200;
|
|
381
|
+
logger.info({ projectRoot: detection.projectRoot, framework: detection.framework }, "Scanning project for test files");
|
|
382
|
+
const found = new Set();
|
|
383
|
+
const searchRoots = detection.testDirs
|
|
384
|
+
.map((d) => path.join(detection.projectRoot, d))
|
|
385
|
+
.filter((d) => fs.existsSync(d));
|
|
386
|
+
const roots = searchRoots.length > 0 ? searchRoots : [detection.projectRoot];
|
|
387
|
+
outer: for (const root of roots) {
|
|
388
|
+
for (const file of walk(root, maxDepth)) {
|
|
389
|
+
const rel = path.relative(detection.projectRoot, file);
|
|
390
|
+
if (matchesAnyGlob(rel, detection.testFileGlobs)) {
|
|
391
|
+
found.add(rel);
|
|
392
|
+
if (found.size >= maxResults)
|
|
393
|
+
break outer;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
const fileList = [...found].sort();
|
|
398
|
+
let output = `## Test Files in ${detection.projectRoot}\n\n`;
|
|
399
|
+
output += `- **Language**: ${detection.language}\n`;
|
|
400
|
+
output += `- **Framework**: ${detection.framework} (detected from ${detection.detectedFrom})\n`;
|
|
401
|
+
output += `- **Package manager**: ${detection.packageManager ?? "n/a"}\n`;
|
|
402
|
+
output += `- **Search roots**: ${roots.map((r) => path.relative(detection.projectRoot, r) || ".").join(", ")}\n`;
|
|
403
|
+
output += `- **Globs**: ${detection.testFileGlobs.join(", ")}\n`;
|
|
404
|
+
output += `- **Matched**: ${fileList.length}${fileList.length >= maxResults ? " (cap reached)" : ""}\n\n`;
|
|
405
|
+
if (fileList.length === 0) {
|
|
406
|
+
output +=
|
|
407
|
+
"_No matching test files found. Try a different `projectRoot` or pass explicit `maxDepth`._\n";
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
output += fileList.map((f) => `- ${f}`).join("\n") + "\n";
|
|
411
|
+
}
|
|
412
|
+
return { content: [{ type: "text", text: output }] };
|
|
413
|
+
}
|
|
414
|
+
catch (error) {
|
|
415
|
+
return handleMCPError("listTestFiles", error);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
tools.setupTestingBot = server.tool("setupTestingBot", "Detect the testing framework in a project and return the ready-to-paste TestingBot configuration snippet, install command, and env-var requirements. Read-only — never modifies files; the agent or user applies the snippet.", {
|
|
419
|
+
projectRoot: z.string().min(1).describe("Absolute path to the project root to inspect."),
|
|
420
|
+
frameworkOverride: z
|
|
421
|
+
.enum(["playwright", "cypress", "webdriverio", "selenium-js", "nightwatch", "puppeteer"])
|
|
422
|
+
.optional()
|
|
423
|
+
.describe("Force a specific framework instead of using auto-detection."),
|
|
424
|
+
}, async (args) => {
|
|
425
|
+
try {
|
|
426
|
+
const detection = detectFramework(args.projectRoot);
|
|
427
|
+
const framework = args.frameworkOverride ?? detection.framework;
|
|
428
|
+
logger.info({ projectRoot: detection.projectRoot, framework, override: !!args.frameworkOverride }, "Generating SDK setup instructions");
|
|
429
|
+
const snippet = configSnippet(framework, detection.language);
|
|
430
|
+
const install = installCommand(framework, detection.packageManager);
|
|
431
|
+
let output = `## TestingBot SDK Setup\n\n`;
|
|
432
|
+
output += `- **Project**: ${detection.projectRoot}\n`;
|
|
433
|
+
output += `- **Language**: ${detection.language}\n`;
|
|
434
|
+
output += `- **Framework**: ${framework}${args.frameworkOverride ? " (overridden)" : ` (detected from ${detection.detectedFrom})`}\n`;
|
|
435
|
+
output += `- **Package manager**: ${detection.packageManager ?? "n/a"}\n\n`;
|
|
436
|
+
output += `### 1. Set credentials\n\nExport these in your shell or CI environment:\n\n`;
|
|
437
|
+
output += "```bash\nexport TESTINGBOT_KEY=...\nexport TESTINGBOT_SECRET=...\n```\n\n";
|
|
438
|
+
output += "Get them at https://testingbot.com/members/user/security\n\n";
|
|
439
|
+
if (install) {
|
|
440
|
+
output += `### 2. Install dependency\n\n\`\`\`bash\n${install}\n\`\`\`\n\n### 3. Configure\n\n`;
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
output += `### 2. Configure\n\n`;
|
|
444
|
+
}
|
|
445
|
+
output += snippet + "\n\n";
|
|
446
|
+
output += `### Next steps\n\n`;
|
|
447
|
+
output += `- Run your existing test command — it will execute against TestingBot.\n`;
|
|
448
|
+
output += `- Use \`getTests\` / \`getTestDetails\` / \`getFailureLogs\` to inspect results.\n`;
|
|
449
|
+
return { content: [{ type: "text", text: output }] };
|
|
450
|
+
}
|
|
451
|
+
catch (error) {
|
|
452
|
+
return handleMCPError("setupTestingBot", error);
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
return tools;
|
|
456
|
+
}
|
|
457
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/tools/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,MAAM,MAAM,kBAAkB,CAAC;AA8BtC,MAAM,uBAAuB,GAAiD;IAC5E,EAAE,GAAG,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY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