@letsrunit/mcp-server 0.14.4 → 0.15.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 +3 -0
- package/dist/{chunk-XJCBPTOU.js → chunk-CEICWMN3.js} +21 -11
- package/dist/chunk-CEICWMN3.js.map +1 -0
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/{tools-CNEENZR2.js → tools-S474WB47.js} +114 -45
- package/dist/tools-S474WB47.js.map +1 -0
- package/package.json +8 -8
- package/src/bootstrap.ts +20 -9
- package/src/index.ts +5 -3
- package/src/tools/diagnostics.ts +2 -2
- package/src/tools/index.ts +1 -0
- package/src/tools/reload.ts +56 -0
- package/src/tools/session-start.ts +13 -3
- package/src/utility/diagnostics.ts +159 -0
- package/src/utility/support.ts +46 -153
- package/dist/chunk-XJCBPTOU.js.map +0 -1
- package/dist/tools-CNEENZR2.js.map +0 -1
package/README.md
CHANGED
|
@@ -61,6 +61,8 @@ At runtime, letsrunit checks the current project:
|
|
|
61
61
|
|
|
62
62
|
So custom steps from `features/support/**` are available when `@letsrunit/mcp-server` is installed in that project.
|
|
63
63
|
|
|
64
|
+
When you edit existing support files during a long-running agent session, call `letsrunit_reload` to rebuild and reload step definitions without restarting the agent.
|
|
65
|
+
|
|
64
66
|
## Tools
|
|
65
67
|
|
|
66
68
|
| Tool | Description |
|
|
@@ -71,6 +73,7 @@ So custom steps from `features/support/**` are available when `@letsrunit/mcp-se
|
|
|
71
73
|
| `letsrunit_snapshot` | Get the current page HTML, scrubbed for LLM consumption. Scope to a DOM subtree with `selector`. |
|
|
72
74
|
| `letsrunit_screenshot` | Take a screenshot. Optionally crop to a selector or highlight elements before capturing. |
|
|
73
75
|
| `letsrunit_debug` | Evaluate JavaScript on the current page via `page.evaluate()`. Use for debugging, not test logic. |
|
|
76
|
+
| `letsrunit_reload` | Rebuild and reload built-in + project support step definitions after step-file changes. Available in project runtime mode. |
|
|
74
77
|
| `letsrunit_diagnostics` | Return runtime diagnostics (`cwd`, `LETSRUNIT_PROJECT_CWD`, detected cucumber config, resolved support entries). Available only when `LETSRUNIT_MCP_DIAGNOSTICS=enabled`. |
|
|
75
78
|
| `letsrunit_session_close` | Close a browser session and release its resources. |
|
|
76
79
|
| `letsrunit_list_sessions` | List all active browser sessions. |
|
|
@@ -30,16 +30,28 @@ function sameEntrypoint(a, b) {
|
|
|
30
30
|
if (!a || !b) return false;
|
|
31
31
|
return a === b;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function resolveRuntimeModeOverride() {
|
|
34
|
+
const runtimeMode = process.env.LETSRUNIT_MCP_RUNTIME_MODE;
|
|
35
|
+
if (runtimeMode == null || runtimeMode === "") {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
if (runtimeMode === "project" || runtimeMode === "standalone") {
|
|
39
|
+
return runtimeMode;
|
|
40
|
+
}
|
|
41
|
+
throw new Error(
|
|
42
|
+
`Invalid LETSRUNIT_MCP_RUNTIME_MODE: ${runtimeMode}. Expected "project" or "standalone".`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function decideHandoff(currentEntrypointPath, projectEntrypointPath, runtimeModeOverride) {
|
|
46
|
+
if (runtimeModeOverride) {
|
|
47
|
+
return { shouldHandoff: false, runtimeMode: runtimeModeOverride };
|
|
48
|
+
}
|
|
34
49
|
if (!projectEntrypointPath) {
|
|
35
50
|
return { shouldHandoff: false, runtimeMode: "standalone" };
|
|
36
51
|
}
|
|
37
52
|
if (sameEntrypoint(currentEntrypointPath, projectEntrypointPath)) {
|
|
38
53
|
return { shouldHandoff: false, runtimeMode: "project" };
|
|
39
54
|
}
|
|
40
|
-
if (isBootstrapped) {
|
|
41
|
-
return { shouldHandoff: false, runtimeMode: "standalone" };
|
|
42
|
-
}
|
|
43
55
|
return { shouldHandoff: true, runtimeMode: "project" };
|
|
44
56
|
}
|
|
45
57
|
function runProjectLocalServer(projectEntrypointPath) {
|
|
@@ -47,7 +59,6 @@ function runProjectLocalServer(projectEntrypointPath) {
|
|
|
47
59
|
stdio: "inherit",
|
|
48
60
|
env: {
|
|
49
61
|
...process.env,
|
|
50
|
-
LETSRUNIT_MCP_BOOTSTRAPPED: "1",
|
|
51
62
|
LETSRUNIT_MCP_RUNTIME_MODE: "project"
|
|
52
63
|
}
|
|
53
64
|
});
|
|
@@ -56,17 +67,16 @@ function runProjectLocalServer(projectEntrypointPath) {
|
|
|
56
67
|
}
|
|
57
68
|
function bootstrapProjectServer() {
|
|
58
69
|
const projectRoot = resolveProjectRoot();
|
|
59
|
-
const
|
|
70
|
+
const runtimeModeOverride = resolveRuntimeModeOverride();
|
|
60
71
|
const currentEntryPath = toRealpath(fileURLToPath(import.meta.url));
|
|
61
72
|
const projectEntryPath = toRealpath(resolveFromProject("@letsrunit/mcp-server", projectRoot));
|
|
62
|
-
const decision = decideHandoff(currentEntryPath, projectEntryPath,
|
|
73
|
+
const decision = decideHandoff(currentEntryPath, projectEntryPath, runtimeModeOverride);
|
|
63
74
|
if (decision.shouldHandoff && projectEntryPath) {
|
|
64
75
|
runProjectLocalServer(projectEntryPath);
|
|
65
76
|
}
|
|
66
|
-
process.env.LETSRUNIT_MCP_RUNTIME_MODE = decision.runtimeMode;
|
|
67
77
|
return decision.runtimeMode;
|
|
68
78
|
}
|
|
69
79
|
|
|
70
|
-
export { bootstrapProjectServer, decideHandoff };
|
|
71
|
-
//# sourceMappingURL=chunk-
|
|
72
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
export { bootstrapProjectServer, decideHandoff, resolveRuntimeModeOverride };
|
|
81
|
+
//# sourceMappingURL=chunk-CEICWMN3.js.map
|
|
82
|
+
//# sourceMappingURL=chunk-CEICWMN3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/bootstrap.ts"],"names":[],"mappings":";;;;;;;;;AAaA,SAAS,kBAAA,GAA6B;AACpC,EAAA,OAAO,QAAQ,OAAA,CAAQ,GAA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A,CAAS,iBAAiB,gBAAA,EAAkB;AAC9C,IAAA,qBAAA,CAAsB,gBAAgB,CAAA;AAAA,EACxC;AAEA,EAAA,OAAO,QAAA,CAAS,WAAA;AAClB","file":"chunk-CEICWMN3.js","sourcesContent":["import { spawnSync } from 'node:child_process';\nimport { realpathSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nexport type McpRuntimeMode = 'project' | 'standalone';\n\nexport type HandoffDecision = {\n shouldHandoff: boolean;\n runtimeMode: McpRuntimeMode;\n};\n\nfunction resolveProjectRoot(): string {\n return resolve(process.env.LETSRUNIT_PROJECT_CWD ?? process.cwd());\n}\n\nfunction resolveFromProject(moduleId: string, projectRoot: string): string | null {\n try {\n const req = createRequire(resolve(projectRoot, 'package.json'));\n return req.resolve(moduleId);\n } catch {\n return null;\n }\n}\n\nfunction toRealpath(path: string | null): string | null {\n if (!path) return null;\n try {\n return realpathSync(path);\n } catch {\n return null;\n }\n}\n\nfunction sameEntrypoint(a: string | null, b: string | null): boolean {\n if (!a || !b) return false;\n return a === b;\n}\n\nexport function resolveRuntimeModeOverride(): McpRuntimeMode | null {\n const runtimeMode = process.env.LETSRUNIT_MCP_RUNTIME_MODE;\n if (runtimeMode == null || runtimeMode === '') {\n return null;\n }\n if (runtimeMode === 'project' || runtimeMode === 'standalone') {\n return runtimeMode;\n }\n throw new Error(\n `Invalid LETSRUNIT_MCP_RUNTIME_MODE: ${runtimeMode}. Expected \"project\" or \"standalone\".`,\n );\n}\n\nexport function decideHandoff(\n currentEntrypointPath: string | null,\n projectEntrypointPath: string | null,\n runtimeModeOverride: McpRuntimeMode | null,\n): HandoffDecision {\n if (runtimeModeOverride) {\n return { shouldHandoff: false, runtimeMode: runtimeModeOverride };\n }\n\n if (!projectEntrypointPath) {\n return { shouldHandoff: false, runtimeMode: 'standalone' };\n }\n\n if (sameEntrypoint(currentEntrypointPath, projectEntrypointPath)) {\n return { shouldHandoff: false, runtimeMode: 'project' };\n }\n\n return { shouldHandoff: true, runtimeMode: 'project' };\n}\n\nfunction runProjectLocalServer(projectEntrypointPath: string): never {\n const result = spawnSync(process.execPath, [projectEntrypointPath, ...process.argv.slice(2)], {\n stdio: 'inherit',\n env: {\n ...process.env,\n LETSRUNIT_MCP_RUNTIME_MODE: 'project',\n },\n });\n\n if (result.error) throw result.error;\n process.exit(result.status ?? 1);\n}\n\nexport function bootstrapProjectServer(): McpRuntimeMode {\n const projectRoot = resolveProjectRoot();\n const runtimeModeOverride = resolveRuntimeModeOverride();\n\n const currentEntryPath = toRealpath(fileURLToPath(import.meta.url));\n const projectEntryPath = toRealpath(resolveFromProject('@letsrunit/mcp-server', projectRoot));\n\n const decision = decideHandoff(currentEntryPath, projectEntryPath, runtimeModeOverride);\n\n if (decision.shouldHandoff && projectEntryPath) {\n runProjectLocalServer(projectEntryPath);\n }\n\n return decision.runtimeMode;\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as __m from 'node:module';
|
|
3
|
-
import { bootstrapProjectServer } from './chunk-
|
|
3
|
+
import { bootstrapProjectServer } from './chunk-CEICWMN3.js';
|
|
4
4
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
5
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
6
6
|
|
|
7
7
|
__m.createRequire(import.meta.url);
|
|
8
|
-
var version = "0.
|
|
9
|
-
bootstrapProjectServer();
|
|
8
|
+
var version = "0.15.0" ;
|
|
9
|
+
var runtimeMode = bootstrapProjectServer();
|
|
10
10
|
var { SessionManager } = await import('./sessions-BYH3NJQG.js');
|
|
11
11
|
var {
|
|
12
12
|
registerDebug,
|
|
@@ -14,19 +14,20 @@ var {
|
|
|
14
14
|
registerDiff,
|
|
15
15
|
registerListSteps,
|
|
16
16
|
registerListSessions,
|
|
17
|
+
registerReload,
|
|
17
18
|
registerRun,
|
|
18
19
|
registerScreenshot,
|
|
19
20
|
registerSessionClose,
|
|
20
21
|
registerSessionStart,
|
|
21
22
|
registerSnapshot
|
|
22
|
-
} = await import('./tools-
|
|
23
|
+
} = await import('./tools-S474WB47.js');
|
|
23
24
|
var sessions = new SessionManager();
|
|
24
25
|
var server = new McpServer({
|
|
25
26
|
name: "letsrunit",
|
|
26
27
|
version,
|
|
27
28
|
websiteUrl: "https://letsrunit.ai"
|
|
28
29
|
});
|
|
29
|
-
registerSessionStart(server, sessions);
|
|
30
|
+
registerSessionStart(server, sessions, { runtimeMode });
|
|
30
31
|
registerRun(server, sessions);
|
|
31
32
|
registerSnapshot(server, sessions);
|
|
32
33
|
registerScreenshot(server, sessions);
|
|
@@ -34,6 +35,7 @@ registerDebug(server, sessions);
|
|
|
34
35
|
registerSessionClose(server, sessions);
|
|
35
36
|
registerListSteps(server, sessions);
|
|
36
37
|
registerListSessions(server, sessions);
|
|
38
|
+
registerReload(server, { runtimeMode });
|
|
37
39
|
registerDiff(server, sessions);
|
|
38
40
|
if (process.env.LETSRUNIT_MCP_DIAGNOSTICS === "enabled") {
|
|
39
41
|
registerDiagnostics(server, sessions);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;AAMA,IAAM,OAAA,GAAsD,QAAA,CAAwB;AACpF,sBAAA,EAAuB;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;AAMA,IAAM,OAAA,GAAsD,QAAA,CAAwB;AACpF,IAAM,cAAc,sBAAA,EAAuB;AAE3C,IAAM,EAAE,cAAA,EAAe,GAAI,MAAM,OAAO,wBAAY,CAAA;AACpD,IAAM;AAAA,EACJ,aAAA;AAAA,EACA,mBAAA;AAAA,EACA,YAAA;AAAA,EACA,iBAAA;AAAA,EACA,oBAAA;AAAA,EACA,cAAA;AAAA,EACA,WAAA;AAAA,EACA,kBAAA;AAAA,EACA,oBAAA;AAAA,EACA,oBAAA;AAAA,EACA;AACF,CAAA,GAAI,MAAM,OAAO,qBAAS,CAAA;AAE1B,IAAM,QAAA,GAAW,IAAI,cAAA,EAAe;AAEpC,IAAM,MAAA,GAAS,IAAI,SAAA,CAAU;AAAA,EAC3B,IAAA,EAAM,WAAA;AAAA,EACN,OAAA;AAAA,EACA,UAAA,EAAY;AACd,CAAC,CAAA;AAED,oBAAA,CAAqB,MAAA,EAAQ,QAAA,EAAU,EAAE,WAAA,EAAa,CAAA;AACtD,WAAA,CAAY,QAAQ,QAAQ,CAAA;AAC5B,gBAAA,CAAiB,QAAQ,QAAQ,CAAA;AACjC,kBAAA,CAAmB,QAAQ,QAAQ,CAAA;AACnC,aAAA,CAAc,QAAQ,QAAQ,CAAA;AAC9B,oBAAA,CAAqB,QAAQ,QAAQ,CAAA;AACrC,iBAAA,CAAkB,QAAQ,QAAQ,CAAA;AAClC,oBAAA,CAAqB,QAAQ,QAAQ,CAAA;AACrC,cAAA,CAAe,MAAA,EAAQ,EAAE,WAAA,EAAa,CAAA;AACtC,YAAA,CAAa,QAAQ,QAAQ,CAAA;AAC7B,IAAI,OAAA,CAAQ,GAAA,CAAI,yBAAA,KAA8B,SAAA,EAAW;AACvD,EAAA,mBAAA,CAAoB,QAAQ,QAAQ,CAAA;AACtC;AAEA,IAAM,SAAA,GAAY,IAAI,oBAAA,EAAqB;AAC3C,MAAM,MAAA,CAAO,QAAQ,SAAS,CAAA","file":"index.js","sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { bootstrapProjectServer } from './bootstrap';\n\ndeclare const __LETSRUNIT_VERSION__: string | undefined;\n\nconst version = typeof __LETSRUNIT_VERSION__ === 'string' ? __LETSRUNIT_VERSION__ : 'unknown';\nconst runtimeMode = bootstrapProjectServer();\n\nconst { SessionManager } = await import('./sessions');\nconst {\n registerDebug,\n registerDiagnostics,\n registerDiff,\n registerListSteps,\n registerListSessions,\n registerReload,\n registerRun,\n registerScreenshot,\n registerSessionClose,\n registerSessionStart,\n registerSnapshot,\n} = await import('./tools');\n\nconst sessions = new SessionManager();\n\nconst server = new McpServer({\n name: 'letsrunit',\n version,\n websiteUrl: 'https://letsrunit.ai',\n});\n\nregisterSessionStart(server, sessions, { runtimeMode });\nregisterRun(server, sessions);\nregisterSnapshot(server, sessions);\nregisterScreenshot(server, sessions);\nregisterDebug(server, sessions);\nregisterSessionClose(server, sessions);\nregisterListSteps(server, sessions);\nregisterListSessions(server, sessions);\nregisterReload(server, { runtimeMode });\nregisterDiff(server, sessions);\nif (process.env.LETSRUNIT_MCP_DIAGNOSTICS === 'enabled') {\n registerDiagnostics(server, sessions);\n}\n\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as __m from 'node:module';
|
|
3
|
-
import { decideHandoff } from './chunk-
|
|
3
|
+
import { decideHandoff, resolveRuntimeModeOverride } from './chunk-CEICWMN3.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { loadConfiguration } from '@cucumber/cucumber/api';
|
|
6
6
|
import { registry } from '@letsrunit/bdd';
|
|
7
7
|
import { readFileSync, existsSync, realpathSync } from 'fs';
|
|
8
|
-
import { mkdir, writeFile, glob } from 'fs/promises';
|
|
9
8
|
import { createRequire } from 'module';
|
|
10
9
|
import { join, dirname, resolve, isAbsolute } from 'path';
|
|
11
10
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
11
|
+
import { mkdir, writeFile, glob } from 'fs/promises';
|
|
12
12
|
import { unifiedHtmlDiff, screenshotElement, screenshot, scrubHtml } from '@letsrunit/playwright';
|
|
13
13
|
import { openStore, findLastTest, findArtifacts } from '@letsrunit/store';
|
|
14
14
|
import { execSync } from 'child_process';
|
|
@@ -120,6 +120,62 @@ async function loadLetsrunitIgnorePatterns(cwd) {
|
|
|
120
120
|
function resolveEffectiveCwd(cwd) {
|
|
121
121
|
return cwd ?? process.env.LETSRUNIT_PROJECT_CWD ?? process.cwd();
|
|
122
122
|
}
|
|
123
|
+
function getSupportLoadState() {
|
|
124
|
+
return {
|
|
125
|
+
loadedProjectRoots: [...loadedProjectRoots].sort(),
|
|
126
|
+
loadedSupportEntries: [...loadedSupportEntries].sort()
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function clearSupportLoadState() {
|
|
130
|
+
loadedProjectRoots.clear();
|
|
131
|
+
loadedSupportEntries.clear();
|
|
132
|
+
}
|
|
133
|
+
function buildReloadedFileUrl(path) {
|
|
134
|
+
const url = pathToFileURL(path);
|
|
135
|
+
url.searchParams.set("letsrunitReload", Date.now().toString(36));
|
|
136
|
+
return url.href;
|
|
137
|
+
}
|
|
138
|
+
async function loadSupportFiles(cwd, options) {
|
|
139
|
+
const projectRoot = resolve(resolveEffectiveCwd(cwd));
|
|
140
|
+
const forceReload = options?.forceReload === true;
|
|
141
|
+
if (!forceReload && loadedProjectRoots.has(projectRoot)) {
|
|
142
|
+
return { projectRoot, supportEntriesLoaded: 0, ignoredEntries: 0 };
|
|
143
|
+
}
|
|
144
|
+
const { useConfiguration } = await loadConfiguration({}, { cwd: projectRoot });
|
|
145
|
+
const supportPatterns = [...toStrings(useConfiguration.require), ...toStrings(useConfiguration.import)];
|
|
146
|
+
if (supportPatterns.length === 0) {
|
|
147
|
+
loadedProjectRoots.add(projectRoot);
|
|
148
|
+
return { projectRoot, supportEntriesLoaded: 0, ignoredEntries: 0 };
|
|
149
|
+
}
|
|
150
|
+
const ignorePatterns = await loadLetsrunitIgnorePatterns(projectRoot);
|
|
151
|
+
const ignoredPaths = await expandPathPatterns(projectRoot, ignorePatterns);
|
|
152
|
+
const supportEntries = await resolveSupportEntries(projectRoot, supportPatterns);
|
|
153
|
+
let supportEntriesLoaded = 0;
|
|
154
|
+
let ignoredEntries = 0;
|
|
155
|
+
for (const entry of supportEntries) {
|
|
156
|
+
if (entry.kind === "path" && ignoredPaths.has(entry.value)) {
|
|
157
|
+
ignoredEntries += 1;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const key = `${entry.kind}:${entry.value}`;
|
|
161
|
+
if (!forceReload && loadedSupportEntries.has(key)) continue;
|
|
162
|
+
if (entry.kind === "path") {
|
|
163
|
+
await (forceReload ? import(buildReloadedFileUrl(entry.value)) : import(pathToFileURL(entry.value).href));
|
|
164
|
+
} else {
|
|
165
|
+
await import(entry.value);
|
|
166
|
+
}
|
|
167
|
+
supportEntriesLoaded += 1;
|
|
168
|
+
loadedSupportEntries.add(key);
|
|
169
|
+
}
|
|
170
|
+
loadedProjectRoots.add(projectRoot);
|
|
171
|
+
return { projectRoot, supportEntriesLoaded, ignoredEntries };
|
|
172
|
+
}
|
|
173
|
+
async function reloadSupportFiles(cwd) {
|
|
174
|
+
clearSupportLoadState();
|
|
175
|
+
return loadSupportFiles(cwd, { forceReload: true });
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// src/utility/diagnostics.ts
|
|
123
179
|
function resolveFrom(moduleId, fromPath) {
|
|
124
180
|
try {
|
|
125
181
|
const req = createRequire(fromPath);
|
|
@@ -141,18 +197,16 @@ function pickLetsrunitEnv() {
|
|
|
141
197
|
Object.entries(process.env).filter(([key, value]) => key.startsWith("LETSRUNIT_") && typeof value === "string").map(([key, value]) => [key, value])
|
|
142
198
|
);
|
|
143
199
|
}
|
|
144
|
-
function
|
|
145
|
-
return "0.14.4" ;
|
|
146
|
-
}
|
|
147
|
-
async function collectSupportDiagnostics(cwd) {
|
|
200
|
+
async function collectDiagnostics(cwd) {
|
|
148
201
|
const effectiveCwd = resolveEffectiveCwd(cwd);
|
|
149
202
|
const projectRoot = resolve(effectiveCwd);
|
|
150
203
|
const cucumberConfigPath = findCucumberConfig(projectRoot);
|
|
151
204
|
const { useConfiguration } = await loadConfiguration({}, { cwd: projectRoot });
|
|
152
|
-
const supportPatterns = [...
|
|
205
|
+
const supportPatterns = [...useConfiguration.require ?? [], ...useConfiguration.import ?? []];
|
|
153
206
|
const ignorePatterns = await loadLetsrunitIgnorePatterns(projectRoot);
|
|
154
207
|
const ignoredPaths = await expandPathPatterns(projectRoot, ignorePatterns);
|
|
155
208
|
const supportEntries = await resolveSupportEntries(projectRoot, supportPatterns);
|
|
209
|
+
const supportLoadState = getSupportLoadState();
|
|
156
210
|
const serverBddPath = toRealpath(resolveFrom("@letsrunit/bdd", import.meta.url));
|
|
157
211
|
const projectBddPath = toRealpath(resolveFrom("@letsrunit/bdd", resolve(projectRoot, "package.json")));
|
|
158
212
|
const projectMcpEntryPath = resolveFrom("@letsrunit/mcp-server", resolve(projectRoot, "package.json"));
|
|
@@ -161,12 +215,12 @@ async function collectSupportDiagnostics(cwd) {
|
|
|
161
215
|
const handoffDecision = decideHandoff(
|
|
162
216
|
currentEntrypointPath,
|
|
163
217
|
projectEntrypointPath,
|
|
164
|
-
|
|
218
|
+
resolveRuntimeModeOverride()
|
|
165
219
|
);
|
|
166
220
|
const serverMcpPath = toRealpath(resolveFrom("@letsrunit/mcp-server", import.meta.url));
|
|
167
221
|
const projectMcpPath = toRealpath(projectMcpEntryPath);
|
|
168
222
|
const executablePath = toRealpath(process.argv[1] ?? null);
|
|
169
|
-
const version =
|
|
223
|
+
const version = "0.15.0" ;
|
|
170
224
|
const registryDefinitions = registry.defs.map((def) => ({
|
|
171
225
|
type: def.type,
|
|
172
226
|
source: def.source,
|
|
@@ -183,8 +237,8 @@ async function collectSupportDiagnostics(cwd) {
|
|
|
183
237
|
ignorePatterns,
|
|
184
238
|
ignoredPaths: [...ignoredPaths].sort(),
|
|
185
239
|
supportEntries,
|
|
186
|
-
loadedProjectRoots:
|
|
187
|
-
loadedSupportEntries:
|
|
240
|
+
loadedProjectRoots: supportLoadState.loadedProjectRoots,
|
|
241
|
+
loadedSupportEntries: supportLoadState.loadedSupportEntries,
|
|
188
242
|
mcpServer: {
|
|
189
243
|
version,
|
|
190
244
|
executablePath,
|
|
@@ -212,33 +266,6 @@ async function collectSupportDiagnostics(cwd) {
|
|
|
212
266
|
}
|
|
213
267
|
};
|
|
214
268
|
}
|
|
215
|
-
async function loadSupportFiles(cwd) {
|
|
216
|
-
const projectRoot = resolve(resolveEffectiveCwd(cwd));
|
|
217
|
-
if (loadedProjectRoots.has(projectRoot)) return;
|
|
218
|
-
const { useConfiguration } = await loadConfiguration({}, { cwd: projectRoot });
|
|
219
|
-
const supportPatterns = [...toStrings(useConfiguration.require), ...toStrings(useConfiguration.import)];
|
|
220
|
-
if (supportPatterns.length === 0) {
|
|
221
|
-
loadedProjectRoots.add(projectRoot);
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
const ignorePatterns = await loadLetsrunitIgnorePatterns(projectRoot);
|
|
225
|
-
const ignoredPaths = await expandPathPatterns(projectRoot, ignorePatterns);
|
|
226
|
-
const supportEntries = await resolveSupportEntries(projectRoot, supportPatterns);
|
|
227
|
-
for (const entry of supportEntries) {
|
|
228
|
-
if (entry.kind === "path" && ignoredPaths.has(entry.value)) {
|
|
229
|
-
continue;
|
|
230
|
-
}
|
|
231
|
-
const key = `${entry.kind}:${entry.value}`;
|
|
232
|
-
if (loadedSupportEntries.has(key)) continue;
|
|
233
|
-
if (entry.kind === "path") {
|
|
234
|
-
await import(pathToFileURL(entry.value).href);
|
|
235
|
-
} else {
|
|
236
|
-
await import(entry.value);
|
|
237
|
-
}
|
|
238
|
-
loadedSupportEntries.add(key);
|
|
239
|
-
}
|
|
240
|
-
loadedProjectRoots.add(projectRoot);
|
|
241
|
-
}
|
|
242
269
|
|
|
243
270
|
// src/tools/diagnostics.ts
|
|
244
271
|
function registerDiagnostics(server, sessions) {
|
|
@@ -252,7 +279,7 @@ function registerDiagnostics(server, sessions) {
|
|
|
252
279
|
},
|
|
253
280
|
async (input) => {
|
|
254
281
|
try {
|
|
255
|
-
const diagnostics = await
|
|
282
|
+
const diagnostics = await collectDiagnostics();
|
|
256
283
|
const session = sessions.get(input.sessionId);
|
|
257
284
|
const sessionInfo = {
|
|
258
285
|
sessionId: session.id,
|
|
@@ -430,6 +457,46 @@ function registerRun(server, sessions) {
|
|
|
430
457
|
}
|
|
431
458
|
);
|
|
432
459
|
}
|
|
460
|
+
async function resetBuiltInStepRegistry() {
|
|
461
|
+
const bdd = await import('@letsrunit/bdd');
|
|
462
|
+
const reset = bdd.resetRegistryToBuiltInSteps;
|
|
463
|
+
if (typeof reset !== "function") {
|
|
464
|
+
throw new Error(
|
|
465
|
+
"Installed @letsrunit/bdd does not expose resetRegistryToBuiltInSteps. Update @letsrunit/bdd to a compatible version."
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
reset();
|
|
469
|
+
}
|
|
470
|
+
function registerReload(server, options) {
|
|
471
|
+
server.registerTool(
|
|
472
|
+
"letsrunit_reload",
|
|
473
|
+
{
|
|
474
|
+
description: "Reload built-in and project support step definitions without restarting the MCP server.",
|
|
475
|
+
inputSchema: {
|
|
476
|
+
cwd: z.string().optional().describe("Project directory to resolve cucumber support files from. Defaults to current project cwd.")
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
async (input) => {
|
|
480
|
+
if (options.runtimeMode !== "project") {
|
|
481
|
+
return err("Reload failed: letsrunit_reload is only available in project runtime mode.");
|
|
482
|
+
}
|
|
483
|
+
try {
|
|
484
|
+
await resetBuiltInStepRegistry();
|
|
485
|
+
const result = await reloadSupportFiles(input.cwd);
|
|
486
|
+
return text(
|
|
487
|
+
JSON.stringify({
|
|
488
|
+
reloaded: true,
|
|
489
|
+
projectRoot: result.projectRoot,
|
|
490
|
+
supportEntriesLoaded: result.supportEntriesLoaded,
|
|
491
|
+
ignoredEntries: result.ignoredEntries
|
|
492
|
+
})
|
|
493
|
+
);
|
|
494
|
+
} catch (e) {
|
|
495
|
+
return err(`Reload failed: ${e.message}`);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
);
|
|
499
|
+
}
|
|
433
500
|
function registerScreenshot(server, sessions) {
|
|
434
501
|
server.registerTool(
|
|
435
502
|
"letsrunit_screenshot",
|
|
@@ -486,13 +553,15 @@ function registerSessionClose(server, sessions) {
|
|
|
486
553
|
}
|
|
487
554
|
);
|
|
488
555
|
}
|
|
489
|
-
function registerSessionStart(server, sessions) {
|
|
556
|
+
function registerSessionStart(server, sessions, opts) {
|
|
490
557
|
server.registerTool(
|
|
491
558
|
"letsrunit_session_start",
|
|
492
559
|
{
|
|
493
560
|
description: `Launch a new browser session. Does not navigate anywhere \u2014 use letsrunit_run with a Given step to navigate. Set baseURL to enable relative paths like "Given I'm on the homepage".`,
|
|
494
561
|
inputSchema: {
|
|
495
|
-
baseURL: z.string().optional().describe(
|
|
562
|
+
baseURL: z.string().optional().describe(
|
|
563
|
+
`Base URL for the session, e.g. "http://localhost:3000". Enables relative paths in Given steps like "Given I'm on the homepage" or "Given I'm on page \\"/login\\""`
|
|
564
|
+
),
|
|
496
565
|
language: z.string().optional().describe("Browser language code, e.g. 'en', 'fr'"),
|
|
497
566
|
headless: z.boolean().optional().describe("Run browser in headless mode (default: true)"),
|
|
498
567
|
viewportWidth: z.number().int().optional().describe("Viewport width in pixels (default: 1280)"),
|
|
@@ -501,7 +570,7 @@ function registerSessionStart(server, sessions) {
|
|
|
501
570
|
},
|
|
502
571
|
async (input) => {
|
|
503
572
|
try {
|
|
504
|
-
if (
|
|
573
|
+
if (opts?.runtimeMode === "project") {
|
|
505
574
|
await loadSupportFiles();
|
|
506
575
|
}
|
|
507
576
|
const viewport = input.viewportWidth || input.viewportHeight ? { width: input.viewportWidth ?? 1280, height: input.viewportHeight ?? 720 } : void 0;
|
|
@@ -564,6 +633,6 @@ function registerSnapshot(server, sessions) {
|
|
|
564
633
|
);
|
|
565
634
|
}
|
|
566
635
|
|
|
567
|
-
export { registerDebug, registerDiagnostics, registerDiff, registerListSessions, registerListSteps, registerRun, registerScreenshot, registerSessionClose, registerSessionStart, registerSnapshot };
|
|
568
|
-
//# sourceMappingURL=tools-
|
|
569
|
-
//# sourceMappingURL=tools-
|
|
636
|
+
export { registerDebug, registerDiagnostics, registerDiff, registerListSessions, registerListSteps, registerReload, registerRun, registerScreenshot, registerSessionClose, registerSessionStart, registerSnapshot };
|
|
637
|
+
//# sourceMappingURL=tools-S474WB47.js.map
|
|
638
|
+
//# sourceMappingURL=tools-S474WB47.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utility/response.ts","../src/tools/debug.ts","../src/utility/support.ts","../src/utility/diagnostics.ts","../src/tools/diagnostics.ts","../src/tools/diff.ts","../src/tools/list-steps.ts","../src/tools/list-sessions.ts","../src/utility/gherkin.ts","../src/tools/run.ts","../src/tools/reload.ts","../src/tools/screenshot.ts","../src/tools/session-close.ts","../src/tools/session-start.ts","../src/tools/snapshot.ts"],"names":["resolve","loadConfiguration","z","join"],"mappings":";;;;;;;;;;;;;;;;;;;AAAO,SAAS,KAAK,OAAA,EAAiB;AACpC,EAAA,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,MAAA,EAAiB,IAAA,EAAM,OAAA,EAAS,CAAA,EAAE;AAC/D;AAEO,SAAS,IAAI,OAAA,EAAiB;AACnC,EAAA,OAAO,EAAE,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,MAAA,EAAiB,IAAA,EAAM,OAAA,EAAS,CAAA,EAAG,OAAA,EAAS,IAAA,EAAK;AAC9E;;;ACDO,SAAS,aAAA,CAAc,QAAmB,QAAA,EAAgC;AAC/E,EAAA,MAAA,CAAO,YAAA;AAAA,IACL,iBAAA;AAAA,IACA;AAAA,MACE,WAAA,EACE,sHAAA;AAAA,MACF,WAAA,EAAa;AAAA,QACX,SAAA,EAAW,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,YAAY,CAAA;AAAA,QAC3C,MAAA,EAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,wEAAwE;AAAA;AACtG,KACF;AAAA,IACA,OAAO,KAAA,KAAU;AACf,MAAA,I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A,QACnC;AAEA,QAAA,OAAO,KAAK,IAAA,CAAK,SAAA,CAAU,EAAE,GAAA,EAAK,IAAA,EAAM,CAAC,CAAA;AAAA,MAC3C,SAAS,CAAA,EAAG;AACV,QAAA,OAAO,GAAA,CAAI,CAAA,iBAAA,EAAqB,CAAA,CAAY,OAAO,CAAA,CAAE,CAAA;AAAA,MACvD;AAAA,IACF;AAAA,GACF;AACF","file":"tools-S474WB47.js","sourcesContent":["export function text(content: string) {\n return { content: [{ type: 'text' as const, text: content }] };\n}\n\nexport function err(message: string) {\n return { content: [{ type: 'text' as const, text: message }], isError: true };\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport { type SessionManager } from '../sessions';\nimport { text } from '../utility/response';\n\nexport function registerDebug(server: McpServer, sessions: SessionManager): void {\n server.registerTool(\n 'letsrunit_debug',\n {\n description:\n 'Evaluate JavaScript on the current page via Playwright page.evaluate(). Use for debugging — not for test logic.',\n inputSchema: {\n sessionId: z.string().describe('Session ID'),\n script: z.string().describe('JavaScript expression or function body to evaluate in the page context'),\n },\n },\n async (input) => {\n try {\n const session = sessions.get(input.sessionId);\n sessions.touch(input.sessionId);\n\n const result = await session.controller.page.evaluate(input.script);\n return text(JSON.stringify({ result }));\n } catch (e) {\n return text(JSON.stringify({ result: null, error: (e as Error).message }));\n }\n },\n );\n}\n","import { loadConfiguration } from '@cucumber/cucumber/api';\nimport { existsSync } from 'node:fs';\nimport { glob } from 'node:fs/promises';\nimport { isAbsolute, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\ntype CucumberConfig = {\n require?: unknown;\n import?: unknown;\n letsrunit?: {\n ignore?: unknown;\n };\n};\n\nexport type SupportEntry = { kind: 'path'; value: string } | { kind: 'module'; value: string };\n\nconst CUCUMBER_CONFIG_FILES = [\n 'cucumber.js',\n 'cucumber.mjs',\n 'cucumber.cjs',\n 'cucumber.ts',\n 'cucumber.mts',\n 'cucumber.cts',\n];\n\nconst loadedProjectRoots = new Set<string>();\nconst loadedSupportEntries = new Set<string>();\n\nexport type SupportLoadResult = {\n projectRoot: string;\n supportEntriesLoaded: number;\n ignoredEntries: number;\n};\n\ntype LoadSupportOptions = {\n forceReload?: boolean;\n};\n\nfunction toStrings(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value.filter((entry): entry is string => typeof entry === 'string');\n}\n\nfunction hasGlobMagic(input: string): boolean {\n return /[*?[\\]{}]/.test(input);\n}\n\nfunction isPathLike(input: string): boolean {\n return input.startsWith('.') || input.startsWith('/') || /^[A-Za-z]:[\\\\/]/.test(input);\n}\n\nfunction toAbsolutePath(baseDir: string, input: string): string {\n return isAbsolute(input) ? resolve(input) : resolve(baseDir, input);\n}\n\nfunction normalizeMatch(baseDir: string, match: string): string {\n return isAbsolute(match) ? resolve(match) : resolve(baseDir, match);\n}\n\nexport async function expandPathPatterns(baseDir: string, patterns: string[]): Promise<Set<string>> {\n const files = new Set<string>();\n\n for (const pattern of patterns) {\n if (hasGlobMagic(pattern)) {\n for await (const match of glob(pattern, { cwd: baseDir })) {\n files.add(normalizeMatch(baseDir, match));\n }\n continue;\n }\n\n files.add(toAbsolutePath(baseDir, pattern));\n }\n\n return files;\n}\n\nexport async function resolveSupportEntries(baseDir: string, entries: string[]): Promise<SupportEntry[]> {\n const resolved: SupportEntry[] = [];\n\n for (const entry of entries) {\n if (hasGlobMagic(entry)) {\n for await (const match of glob(entry, { cwd: baseDir })) {\n resolved.push({ kind: 'path', value: normalizeMatch(baseDir, match) });\n }\n continue;\n }\n\n if (!isPathLike(entry)) {\n resolved.push({ kind: 'module', value: entry });\n continue;\n }\n\n resolved.push({ kind: 'path', value: toAbsolutePath(baseDir, entry) });\n }\n\n return resolved;\n}\n\nexport function findCucumberConfig(cwd: string): string | null {\n for (const filename of CUCUMBER_CONFIG_FILES) {\n const path = resolve(cwd, filename);\n if (existsSync(path)) return path;\n }\n\n return null;\n}\n\nexport async function loadLetsrunitIgnorePatterns(cwd: string): Promise<string[]> {\n const configPath = findCucumberConfig(cwd);\n if (!configPath) return [];\n\n const configModule = await import(pathToFileURL(configPath).href);\n const config = (configModule.default ?? configModule) as CucumberConfig;\n\n return toStrings(config.letsrunit?.ignore);\n}\n\nexport function resolveEffectiveCwd(cwd?: string): string {\n return cwd ?? process.env.LETSRUNIT_PROJECT_CWD ?? process.cwd();\n}\n\nexport function getSupportLoadState(): { loadedProjectRoots: string[]; loadedSupportEntries: string[] } {\n return {\n loadedProjectRoots: [...loadedProjectRoots].sort(),\n loadedSupportEntries: [...loadedSupportEntries].sort(),\n };\n}\n\nexport function clearSupportLoadState(): void {\n loadedProjectRoots.clear();\n loadedSupportEntries.clear();\n}\n\nfunction buildReloadedFileUrl(path: string): string {\n const url = pathToFileURL(path);\n url.searchParams.set('letsrunitReload', Date.now().toString(36));\n return url.href;\n}\n\nexport async function loadSupportFiles(cwd?: string, options?: LoadSupportOptions): Promise<SupportLoadResult> {\n const projectRoot = resolve(resolveEffectiveCwd(cwd));\n const forceReload = options?.forceReload === true;\n\n if (!forceReload && loadedProjectRoots.has(projectRoot)) {\n return { projectRoot, supportEntriesLoaded: 0, ignoredEntries: 0 };\n }\n\n const { useConfiguration } = await loadConfiguration({}, { cwd: projectRoot });\n const supportPatterns = [...toStrings(useConfiguration.require), ...toStrings(useConfiguration.import)];\n if (supportPatterns.length === 0) {\n loadedProjectRoots.add(projectRoot);\n return { projectRoot, supportEntriesLoaded: 0, ignoredEntries: 0 };\n }\n\n const ignorePatterns = await loadLetsrunitIgnorePatterns(projectRoot);\n const ignoredPaths = await expandPathPatterns(projectRoot, ignorePatterns);\n const supportEntries = await resolveSupportEntries(projectRoot, supportPatterns);\n let supportEntriesLoaded = 0;\n let ignoredEntries = 0;\n\n for (const entry of supportEntries) {\n if (entry.kind === 'path' && ignoredPaths.has(entry.value)) {\n ignoredEntries += 1;\n continue;\n }\n\n const key = `${entry.kind}:${entry.value}`;\n if (!forceReload && loadedSupportEntries.has(key)) continue;\n\n if (entry.kind === 'path') {\n await import(forceReload ? buildReloadedFileUrl(entry.value) : pathToFileURL(entry.value).href);\n } else {\n await import(entry.value);\n }\n\n supportEntriesLoaded += 1;\n loadedSupportEntries.add(key);\n }\n\n loadedProjectRoots.add(projectRoot);\n return { projectRoot, supportEntriesLoaded, ignoredEntries };\n}\n\nexport async function reloadSupportFiles(cwd?: string): Promise<SupportLoadResult> {\n clearSupportLoadState();\n return loadSupportFiles(cwd, { forceReload: true });\n}\n","import { loadConfiguration } from '@cucumber/cucumber/api';\nimport { registry } from '@letsrunit/bdd';\nimport { realpathSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { decideHandoff, resolveRuntimeModeOverride } from '../bootstrap';\nimport {\n expandPathPatterns,\n findCucumberConfig,\n getSupportLoadState,\n loadLetsrunitIgnorePatterns,\n resolveEffectiveCwd,\n resolveSupportEntries,\n type SupportEntry,\n} from './support';\n\ndeclare const __LETSRUNIT_VERSION__: string | undefined;\n\nexport type Diagnostics = {\n envProjectCwd: string | null;\n processCwd: string;\n inputCwd: string | null;\n effectiveCwd: string;\n projectRoot: string;\n cucumberConfigPath: string | null;\n supportPatterns: string[];\n ignorePatterns: string[];\n ignoredPaths: string[];\n supportEntries: SupportEntry[];\n loadedProjectRoots: string[];\n loadedSupportEntries: string[];\n mcpServer: {\n version: string;\n executablePath: string | null;\n projectServerUsed: boolean;\n handoffDecision: {\n shouldHandoff: boolean;\n runtimeMode: string;\n };\n serverMcpPath: string | null;\n projectMcpPath: string | null;\n };\n letsrunitEnv: Record<string, string>;\n moduleResolution: {\n serverBddPath: string | null;\n projectBddPath: string | null;\n };\n registry: {\n total: number;\n byType: {\n Given: number;\n When: number;\n Then: number;\n };\n definitions: Array<{\n type: 'Given' | 'When' | 'Then';\n source: string;\n comment?: string;\n }>;\n };\n};\n\nfunction resolveFrom(moduleId: string, fromPath: string): string | null {\n try {\n const req = createRequire(fromPath);\n return req.resolve(moduleId);\n } catch {\n return null;\n }\n}\n\nfunction toRealpath(path: string | null): string | null {\n if (!path) return null;\n try {\n return realpathSync(path);\n } catch {\n return path;\n }\n}\n\nfunction pickLetsrunitEnv(): Record<string, string> {\n return Object.fromEntries(\n Object.entries(process.env)\n .filter(([key, value]) => key.startsWith('LETSRUNIT_') && typeof value === 'string')\n .map(([key, value]) => [key, value as string]),\n );\n}\n\nexport async function collectDiagnostics(cwd?: string): Promise<Diagnostics> {\n const effectiveCwd = resolveEffectiveCwd(cwd);\n const projectRoot = resolve(effectiveCwd);\n const cucumberConfigPath = findCucumberConfig(projectRoot);\n const { useConfiguration } = await loadConfiguration({}, { cwd: projectRoot });\n const supportPatterns = [...(useConfiguration.require ?? []), ...(useConfiguration.import ?? [])];\n const ignorePatterns = await loadLetsrunitIgnorePatterns(projectRoot);\n const ignoredPaths = await expandPathPatterns(projectRoot, ignorePatterns);\n const supportEntries = await resolveSupportEntries(projectRoot, supportPatterns);\n const supportLoadState = getSupportLoadState();\n const serverBddPath = toRealpath(resolveFrom('@letsrunit/bdd', import.meta.url));\n const projectBddPath = toRealpath(resolveFrom('@letsrunit/bdd', resolve(projectRoot, 'package.json')));\n const projectMcpEntryPath = resolveFrom('@letsrunit/mcp-server', resolve(projectRoot, 'package.json'));\n const currentEntrypointPath = toRealpath(fileURLToPath(import.meta.url));\n const projectEntrypointPath = toRealpath(projectMcpEntryPath);\n const handoffDecision = decideHandoff(\n currentEntrypointPath,\n projectEntrypointPath,\n resolveRuntimeModeOverride(),\n );\n const serverMcpPath = toRealpath(resolveFrom('@letsrunit/mcp-server', import.meta.url));\n const projectMcpPath = toRealpath(projectMcpEntryPath);\n const executablePath = toRealpath(process.argv[1] ?? null);\n const version = typeof __LETSRUNIT_VERSION__ === 'string' ? __LETSRUNIT_VERSION__ : 'unknown';\n const registryDefinitions = registry.defs.map((def) => ({\n type: def.type,\n source: def.source,\n comment: def.comment,\n }));\n\n return {\n envProjectCwd: process.env.LETSRUNIT_PROJECT_CWD ?? null,\n processCwd: process.cwd(),\n inputCwd: cwd ?? null,\n effectiveCwd,\n projectRoot,\n cucumberConfigPath,\n supportPatterns,\n ignorePatterns,\n ignoredPaths: [...ignoredPaths].sort(),\n supportEntries,\n loadedProjectRoots: supportLoadState.loadedProjectRoots,\n loadedSupportEntries: supportLoadState.loadedSupportEntries,\n mcpServer: {\n version,\n executablePath,\n projectServerUsed: handoffDecision.runtimeMode === 'project',\n handoffDecision: {\n shouldHandoff: handoffDecision.shouldHandoff,\n runtimeMode: handoffDecision.runtimeMode,\n },\n serverMcpPath,\n projectMcpPath,\n },\n letsrunitEnv: pickLetsrunitEnv(),\n moduleResolution: {\n serverBddPath,\n projectBddPath,\n },\n registry: {\n total: registryDefinitions.length,\n byType: {\n Given: registryDefinitions.filter((d) => d.type === 'Given').length,\n When: registryDefinitions.filter((d) => d.type === 'When').length,\n Then: registryDefinitions.filter((d) => d.type === 'Then').length,\n },\n definitions: registryDefinitions,\n },\n };\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport type { SessionManager } from '../sessions';\nimport { collectDiagnostics } from '../utility/diagnostics';\nimport { err, text } from '../utility/response';\n\nexport function registerDiagnostics(server: McpServer, sessions: SessionManager): void {\n server.registerTool(\n 'letsrunit_diagnostics',\n {\n description:\n 'Return runtime diagnostics for MCP support-file loading (cwd resolution, cucumber config path, support entries). Available only when LETSRUNIT_MCP_DIAGNOSTICS=enabled.',\n inputSchema: {\n sessionId: z.string().describe('Session ID returned by letsrunit_session_start'),\n },\n },\n async (input) => {\n try {\n const diagnostics = await collectDiagnostics();\n const session = sessions.get(input.sessionId);\n const sessionInfo = {\n sessionId: session.id,\n createdAt: session.createdAt,\n lastActivity: session.lastActivity,\n stepCount: session.stepCount,\n artifactDir: session.artifactDir,\n pageUrl: session.controller.page.url(),\n };\n return text(JSON.stringify({ ...diagnostics, session: sessionInfo }));\n } catch (e) {\n return err(`Diagnostics failed: ${(e as Error).message}`);\n }\n },\n );\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { unifiedHtmlDiff } from '@letsrunit/playwright';\nimport { openStore, findLastTest, findArtifacts } from '@letsrunit/store';\nimport { execSync } from 'node:child_process';\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { z } from 'zod';\nimport type { SessionManager } from '../sessions';\nimport { err, text } from '../utility/response';\n\nconst DEFAULT_DB_PATH = join(process.cwd(), '.letsrunit', 'letsrunit.db');\n\nfunction getDbPath(): string {\n return process.env.LETSRUNIT_DB_PATH ?? DEFAULT_DB_PATH;\n}\n\nfunction resolveAllowedCommits(): string[] | undefined {\n try {\n const output = execSync('git log --format=%H', { encoding: 'utf8' });\n return output.trim().split('\\n').filter(Boolean);\n } catch {\n return undefined;\n }\n}\n\nexport function registerDiff(server: McpServer, sessions: SessionManager): void {\n server.registerTool(\n 'letsrunit_diff',\n {\n description:\n 'Diff the current live page against the HTML snapshot from the last passing test of a scenario. ' +\n 'Pass the scenarioId returned by letsrunit_run. ' +\n 'Returns a unified HTML diff and paths to baseline screenshots. ' +\n 'By default only considers baseline tests from the current git ancestry (gitTreeOnly: true).',\n inputSchema: {\n sessionId: z.string().describe('Session ID returned by letsrunit_session_start'),\n scenarioId: z.string().describe('Scenario UUID returned by letsrunit_run'),\n gitTreeOnly: z\n .boolean()\n .optional()\n .describe('Restrict baseline to tests from the current git ancestry (default: true)'),\n },\n },\n async (input) => {\n const dbPath = getDbPath();\n const artifactDir = join(dirname(dbPath), 'artifacts');\n let db: ReturnType<typeof openStore> | undefined;\n\n try {\n try {\n db = openStore(dbPath);\n } catch {\n return err('Could not open the letsrunit store. Run cucumber with the store formatter first.');\n }\n\n const allowedCommits = (input.gitTreeOnly ?? true) ? resolveAllowedCommits() : undefined;\n\n const test = findLastTest(db, input.scenarioId, 'passed', allowedCommits ?? undefined);\n if (!test) {\n return err(\n allowedCommits\n ? 'No passing test found for this scenario in the current git ancestry. Try gitTreeOnly: false or run cucumber first.'\n : 'No passing test found for this scenario.',\n );\n }\n\n const artifacts = findArtifacts(db, test.id);\n\n const htmlArtifact = [...artifacts].reverse().find((a) => a.filename.endsWith('.html'));\n if (!htmlArtifact) {\n return err('No HTML snapshot found in the baseline test. Ensure the store formatter is configured.');\n }\n\n const storedHtml = readFileSync(join(artifactDir, htmlArtifact.filename), 'utf-8');\n\n const session = sessions.get(input.sessionId);\n sessions.touch(input.sessionId);\n\n const diff = await unifiedHtmlDiff({ html: storedHtml, url: 'about:blank' }, session.controller.page);\n\n const screenshots = artifacts\n .filter((a) => a.stepIdx === htmlArtifact.stepIdx && a.filename.endsWith('.png'))\n .map((a) => join(artifactDir, a.filename));\n\n return text(\n JSON.stringify({\n diff,\n baseline: {\n testId: test.id,\n commit: test.gitCommit,\n screenshots,\n },\n }),\n );\n } catch (e) {\n return err(`Diff failed: ${(e as Error).message}`);\n } finally {\n db?.close();\n }\n },\n );\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport { type SessionManager } from '../sessions';\nimport { err, text } from '../utility/response';\n\nconst stepTypeSchema = z.enum(['Given', 'When', 'Then']);\n\nexport function registerListSteps(server: McpServer, sessions: SessionManager): void {\n server.registerTool(\n 'letsrunit_list_steps',\n {\n description:\n 'List available step definitions for a session. Optionally filter by step type (Given/When/Then).',\n inputSchema: {\n sessionId: z.string().describe('Session ID returned by letsrunit_session_start'),\n type: stepTypeSchema.optional().describe('Optional step type filter'),\n },\n },\n async (input) => {\n try {\n const session = sessions.get(input.sessionId);\n sessions.touch(input.sessionId);\n\n const steps = session.controller.listSteps(input.type);\n return text(JSON.stringify({ steps }));\n } catch (e) {\n return err(`List steps failed: ${(e as Error).message}`);\n }\n },\n );\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { type SessionManager } from '../sessions';\nimport { text } from '../utility/response';\n\nexport function registerListSessions(server: McpServer, sessions: SessionManager): void {\n server.registerTool(\n 'letsrunit_list_sessions',\n {\n description: 'List all active browser sessions.',\n inputSchema: {},\n },\n async () => {\n const list = sessions.list().map((s) => ({\n sessionId: s.id,\n createdAt: s.createdAt,\n lastActivity: s.lastActivity,\n stepCount: s.stepCount,\n artifactDir: s.artifactDir,\n }));\n\n return text(JSON.stringify({ sessions: list }));\n },\n );\n}\n","export function normalizeGherkin(input: string): string {\n const trimmed = input.trim();\n\n if (/^(Feature|Scenario|Background):/im.test(trimmed)) {\n return trimmed;\n }\n\n return `Feature: MCP\\n\\nScenario: Steps\\n ${trimmed.split('\\n').join('\\n ')}`;\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport { scenarioIdFromGherkin } from '@letsrunit/gherkin';\nimport type { SessionManager } from '../sessions';\nimport { normalizeGherkin } from '../utility/gherkin';\nimport { err, text } from '../utility/response';\n\nexport function registerRun(server: McpServer, sessions: SessionManager): void {\n server.registerTool(\n 'letsrunit_run',\n {\n description:\n 'Execute Gherkin steps or a complete feature in the browser. ' +\n 'Accepts a single step line, multiple step lines, a full Scenario, or a full Feature. ' +\n 'Returns status, steps, reason on failure, and journal entries. Does not return a page snapshot — call letsrunit_snapshot explicitly if you need the DOM.',\n inputSchema: {\n sessionId: z.string().describe('Session ID returned by letsrunit_session_start'),\n input: z\n .string()\n .describe(\n 'Gherkin text to execute: one or more step lines (e.g. \"Given I am on \\\\\"https://example.com\\\\\"\"), a Scenario block, or a full Feature block.',\n ),\n },\n },\n async (input) => {\n try {\n const session = sessions.get(input.sessionId);\n sessions.touch(input.sessionId);\n\n const feature = normalizeGherkin(input.input);\n\n session.sink.clear();\n const result = await session.controller.run(feature);\n session.stepCount += result.steps.length;\n\n return text(\n JSON.stringify({\n status: result.status,\n steps: result.steps,\n reason: result.reason?.message,\n journal: session.sink.getEntries(),\n scenarioId: scenarioIdFromGherkin(input.input),\n }),\n );\n } catch (e) {\n return err(`Run failed: ${(e as Error).message}`);\n }\n },\n );\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport type { McpRuntimeMode } from '../bootstrap';\nimport { err, text } from '../utility/response';\nimport { reloadSupportFiles } from '../utility/support';\n\ntype Options = {\n runtimeMode: McpRuntimeMode;\n};\n\nasync function resetBuiltInStepRegistry(): Promise<void> {\n const bdd = (await import('@letsrunit/bdd')) as Record<string, unknown>;\n const reset = bdd.resetRegistryToBuiltInSteps;\n if (typeof reset !== 'function') {\n throw new Error(\n 'Installed @letsrunit/bdd does not expose resetRegistryToBuiltInSteps. Update @letsrunit/bdd to a compatible version.',\n );\n }\n reset();\n}\n\nexport function registerReload(server: McpServer, options: Options): void {\n server.registerTool(\n 'letsrunit_reload',\n {\n description:\n 'Reload built-in and project support step definitions without restarting the MCP server.',\n inputSchema: {\n cwd: z\n .string()\n .optional()\n .describe('Project directory to resolve cucumber support files from. Defaults to current project cwd.'),\n },\n },\n async (input) => {\n if (options.runtimeMode !== 'project') {\n return err('Reload failed: letsrunit_reload is only available in project runtime mode.');\n }\n\n try {\n await resetBuiltInStepRegistry();\n const result = await reloadSupportFiles(input.cwd);\n return text(\n JSON.stringify({\n reloaded: true,\n projectRoot: result.projectRoot,\n supportEntriesLoaded: result.supportEntriesLoaded,\n ignoredEntries: result.ignoredEntries,\n }),\n );\n } catch (e) {\n return err(`Reload failed: ${(e as Error).message}`);\n }\n },\n );\n}\n","import { screenshot, screenshotElement } from '@letsrunit/playwright';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mkdir, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { z } from 'zod';\nimport { type SessionManager } from '../sessions';\nimport { err, text } from '../utility/response';\n\nexport function registerScreenshot(server: McpServer, sessions: SessionManager): void {\n server.registerTool(\n 'letsrunit_screenshot',\n {\n description:\n 'Take a screenshot of the current page. Optionally crop to a specific element (selector) or highlight elements before capturing (mask).',\n inputSchema: {\n sessionId: z.string().describe('Session ID'),\n selector: z\n .string()\n .optional()\n .describe('CSS selector — crop screenshot to the bounding box of this element'),\n mask: z\n .array(z.string())\n .optional()\n .describe('CSS selectors whose matching elements are highlighted (dark overlay, element spotlighted).'),\n fullPage: z.boolean().optional().describe('Capture the full scrollable page (default: false)'),\n },\n },\n async (input) => {\n try {\n const session = sessions.get(input.sessionId);\n sessions.touch(input.sessionId);\n\n const page = session.controller.page;\n\n let file: File;\n\n if (input.selector) {\n file = await screenshotElement(page, input.selector);\n } else {\n const masks = input.mask?.map((sel) => page.locator(sel)) ?? [];\n file = await screenshot(page, {\n fullPage: input.fullPage ?? false,\n ...(masks.length ? { mask: masks } : {}),\n });\n }\n\n await mkdir(session.artifactDir, { recursive: true });\n const path = join(session.artifactDir, file.name);\n await writeFile(path, await file.bytes());\n\n return text(JSON.stringify({ path, mimeType: 'image/png' }));\n } catch (e) {\n return err(`Screenshot failed: ${(e as Error).message}`);\n }\n },\n );\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport type { SessionManager } from '../sessions';\nimport { err, text } from '../utility/response';\n\nexport function registerSessionClose(server: McpServer, sessions: SessionManager): void {\n server.registerTool(\n 'letsrunit_session_close',\n {\n description: 'Close a browser session and release its resources.',\n inputSchema: {\n sessionId: z.string().describe('Session ID to close'),\n },\n },\n async (input) => {\n try {\n await sessions.close(input.sessionId);\n return text(JSON.stringify({ closed: true }));\n } catch (e) {\n return err(`Failed to close session: ${(e as Error).message}`);\n }\n },\n );\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport type { McpRuntimeMode } from '../bootstrap';\nimport type { SessionManager } from '../sessions';\nimport { err, text } from '../utility/response';\nimport { loadSupportFiles } from '../utility/support';\n\ninterface Options {\n runtimeMode: McpRuntimeMode;\n}\n\nexport function registerSessionStart(server: McpServer, sessions: SessionManager, opts?: Options): void {\n server.registerTool(\n 'letsrunit_session_start',\n {\n description:\n 'Launch a new browser session. Does not navigate anywhere — use letsrunit_run with a Given step to navigate. Set baseURL to enable relative paths like \"Given I\\'m on the homepage\".',\n inputSchema: {\n baseURL: z\n .string()\n .optional()\n .describe(\n 'Base URL for the session, e.g. \"http://localhost:3000\". Enables relative paths in Given steps like \"Given I\\'m on the homepage\" or \"Given I\\'m on page \\\\\"/login\\\\\"\"',\n ),\n language: z.string().optional().describe(\"Browser language code, e.g. 'en', 'fr'\"),\n headless: z.boolean().optional().describe('Run browser in headless mode (default: true)'),\n viewportWidth: z.number().int().optional().describe('Viewport width in pixels (default: 1280)'),\n viewportHeight: z.number().int().optional().describe('Viewport height in pixels (default: 720)'),\n },\n },\n async (input) => {\n try {\n if (opts?.runtimeMode === 'project') {\n await loadSupportFiles();\n }\n\n const viewport =\n input.viewportWidth || input.viewportHeight\n ? { width: input.viewportWidth ?? 1280, height: input.viewportHeight ?? 720 }\n : undefined;\n\n const session = await sessions.create({\n baseURL: input.baseURL,\n headless: input.headless ?? true,\n locale: input.language,\n viewport,\n });\n\n return text(JSON.stringify({ sessionId: session.id }));\n } catch (e) {\n return err(`Failed to start session: ${(e as Error).message}`);\n }\n },\n );\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { scrubHtml } from '@letsrunit/playwright';\nimport { z } from 'zod';\nimport { type SessionManager } from '../sessions';\nimport { err, text } from '../utility/response';\n\nconst stripAttributesSchema = z.nativeEnum({\n none: 0,\n semantic: 1,\n aggressive: 2,\n});\n\nexport function registerSnapshot(server: McpServer, sessions: SessionManager): void {\n server.registerTool(\n 'letsrunit_snapshot',\n {\n description:\n 'Get the current page HTML, scrubbed for LLM consumption. Use selector to scope to a DOM subtree.',\n inputSchema: {\n sessionId: z.string().describe('Session ID'),\n selector: z\n .string()\n .optional()\n .describe(\"CSS selector — return only the matching element's outer HTML instead of the full page\"),\n dropHidden: z.boolean().optional().describe('Remove hidden/inert nodes (default: true)'),\n dropHead: z.boolean().optional().describe('Remove the <head> element (default: true)'),\n pickMain: z.boolean().optional().describe('Keep only the <main> element (default: auto)'),\n stripAttributes: stripAttributesSchema\n .optional()\n .describe('Attribute allowlist level: 0=none, 1=semantic (default), 2=aggressive'),\n },\n },\n async (input) => {\n try {\n const session = sessions.get(input.sessionId);\n sessions.touch(input.sessionId);\n\n const page = session.controller.page;\n const url = page.url();\n\n const opts = {\n dropHidden: input.dropHidden,\n dropHead: input.dropHead,\n pickMain: input.pickMain,\n stripAttributes: input.stripAttributes,\n };\n\n let html: string;\n\n if (input.selector) {\n const rawHtml = await page\n .locator(input.selector)\n .first()\n .evaluate((el: Element) => el.outerHTML);\n html = await scrubHtml({ html: rawHtml, url }, opts);\n } else {\n html = await scrubHtml(page, opts);\n }\n\n return text(JSON.stringify({ url, html }));\n } catch (e) {\n return err(`Snapshot failed: ${(e as Error).message}`);\n }\n },\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letsrunit/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "MCP server for letsrunit — AI-agent browser test generation and execution",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"testing",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"packageManager": "yarn@4.10.3",
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@cucumber/cucumber": "^12.7.0",
|
|
50
|
-
"@letsrunit/bdd": "0.
|
|
51
|
-
"@letsrunit/controller": "0.
|
|
52
|
-
"@letsrunit/gherkin": "0.
|
|
53
|
-
"@letsrunit/journal": "0.
|
|
54
|
-
"@letsrunit/playwright": "0.
|
|
55
|
-
"@letsrunit/store": "0.
|
|
56
|
-
"@letsrunit/utils": "0.
|
|
50
|
+
"@letsrunit/bdd": "0.15.0",
|
|
51
|
+
"@letsrunit/controller": "0.15.0",
|
|
52
|
+
"@letsrunit/gherkin": "0.15.0",
|
|
53
|
+
"@letsrunit/journal": "0.15.0",
|
|
54
|
+
"@letsrunit/playwright": "0.15.0",
|
|
55
|
+
"@letsrunit/store": "0.15.0",
|
|
56
|
+
"@letsrunit/utils": "0.15.0",
|
|
57
57
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
58
58
|
"@playwright/test": "^1.57.0",
|
|
59
59
|
"zod": "^4.3.5"
|
package/src/bootstrap.ts
CHANGED
|
@@ -38,11 +38,28 @@ function sameEntrypoint(a: string | null, b: string | null): boolean {
|
|
|
38
38
|
return a === b;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
export function resolveRuntimeModeOverride(): McpRuntimeMode | null {
|
|
42
|
+
const runtimeMode = process.env.LETSRUNIT_MCP_RUNTIME_MODE;
|
|
43
|
+
if (runtimeMode == null || runtimeMode === '') {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
if (runtimeMode === 'project' || runtimeMode === 'standalone') {
|
|
47
|
+
return runtimeMode;
|
|
48
|
+
}
|
|
49
|
+
throw new Error(
|
|
50
|
+
`Invalid LETSRUNIT_MCP_RUNTIME_MODE: ${runtimeMode}. Expected "project" or "standalone".`,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
41
54
|
export function decideHandoff(
|
|
42
55
|
currentEntrypointPath: string | null,
|
|
43
56
|
projectEntrypointPath: string | null,
|
|
44
|
-
|
|
57
|
+
runtimeModeOverride: McpRuntimeMode | null,
|
|
45
58
|
): HandoffDecision {
|
|
59
|
+
if (runtimeModeOverride) {
|
|
60
|
+
return { shouldHandoff: false, runtimeMode: runtimeModeOverride };
|
|
61
|
+
}
|
|
62
|
+
|
|
46
63
|
if (!projectEntrypointPath) {
|
|
47
64
|
return { shouldHandoff: false, runtimeMode: 'standalone' };
|
|
48
65
|
}
|
|
@@ -51,10 +68,6 @@ export function decideHandoff(
|
|
|
51
68
|
return { shouldHandoff: false, runtimeMode: 'project' };
|
|
52
69
|
}
|
|
53
70
|
|
|
54
|
-
if (isBootstrapped) {
|
|
55
|
-
return { shouldHandoff: false, runtimeMode: 'standalone' };
|
|
56
|
-
}
|
|
57
|
-
|
|
58
71
|
return { shouldHandoff: true, runtimeMode: 'project' };
|
|
59
72
|
}
|
|
60
73
|
|
|
@@ -63,7 +76,6 @@ function runProjectLocalServer(projectEntrypointPath: string): never {
|
|
|
63
76
|
stdio: 'inherit',
|
|
64
77
|
env: {
|
|
65
78
|
...process.env,
|
|
66
|
-
LETSRUNIT_MCP_BOOTSTRAPPED: '1',
|
|
67
79
|
LETSRUNIT_MCP_RUNTIME_MODE: 'project',
|
|
68
80
|
},
|
|
69
81
|
});
|
|
@@ -74,17 +86,16 @@ function runProjectLocalServer(projectEntrypointPath: string): never {
|
|
|
74
86
|
|
|
75
87
|
export function bootstrapProjectServer(): McpRuntimeMode {
|
|
76
88
|
const projectRoot = resolveProjectRoot();
|
|
77
|
-
const
|
|
89
|
+
const runtimeModeOverride = resolveRuntimeModeOverride();
|
|
78
90
|
|
|
79
91
|
const currentEntryPath = toRealpath(fileURLToPath(import.meta.url));
|
|
80
92
|
const projectEntryPath = toRealpath(resolveFromProject('@letsrunit/mcp-server', projectRoot));
|
|
81
93
|
|
|
82
|
-
const decision = decideHandoff(currentEntryPath, projectEntryPath,
|
|
94
|
+
const decision = decideHandoff(currentEntryPath, projectEntryPath, runtimeModeOverride);
|
|
83
95
|
|
|
84
96
|
if (decision.shouldHandoff && projectEntryPath) {
|
|
85
97
|
runProjectLocalServer(projectEntryPath);
|
|
86
98
|
}
|
|
87
99
|
|
|
88
|
-
process.env.LETSRUNIT_MCP_RUNTIME_MODE = decision.runtimeMode;
|
|
89
100
|
return decision.runtimeMode;
|
|
90
101
|
}
|