@skyramp/mcp 0.0.19 → 0.0.21
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.
|
@@ -2,70 +2,7 @@ export function getModularizationPrompt(filePath, language) {
|
|
|
2
2
|
return `
|
|
3
3
|
**CRITICAL: Refactor code with modularization principles. Respond with complete, modularized code only WITHOUT ERRORS AND WRITTEN BACK TO THE FILE ${filePath}**
|
|
4
4
|
|
|
5
|
-
**
|
|
6
|
-
You MUST search for existing test files by language and NOT ALL LANGUAGE FILES:
|
|
7
|
-
${language === "python" ? `Python: .py files with "skyramp"` : ""}
|
|
8
|
-
|
|
9
|
-
${language === "typescript" || language === "javascript"
|
|
10
|
-
? `TypeScript/JavaScript: .ts/.js files with "@skyramp/skyramp"`
|
|
11
|
-
: ""}
|
|
12
|
-
|
|
13
|
-
${language === "java" ? `Java: .java files with "SkyrampClient"` : ""}
|
|
14
|
-
|
|
15
|
-
You MUST look for reusable patterns: authentication, HTTP helpers, data setup, validation, configuration, cleanup functions EXCLUDE current test file from the search.
|
|
16
|
-
|
|
17
|
-
**STEP 2: IMPORT & REUSE (HIGHEST PRIORITY) - MANDATORY**
|
|
18
|
-
You MUST import existing functions instead of duplicating. If you find reusable functions, you MUST import them:
|
|
19
|
-
${language === "python"
|
|
20
|
-
? `\`\`\`python
|
|
21
|
-
from path.to.existing import helper_function
|
|
22
|
-
from utils.auth_helpers import authenticate
|
|
23
|
-
\`\`\``
|
|
24
|
-
: ""}
|
|
25
|
-
|
|
26
|
-
${language === "typescript" || language === "javascript"
|
|
27
|
-
? `\`\`\`typescript/javascript
|
|
28
|
-
import { helperFunction } from './path/to/existing';
|
|
29
|
-
import { authenticate } from './utils/authHelpers';
|
|
30
|
-
\`\`\``
|
|
31
|
-
: ""}
|
|
32
|
-
|
|
33
|
-
${language === "java"
|
|
34
|
-
? `\`\`\`java
|
|
35
|
-
import path.to.existing.helper_function;
|
|
36
|
-
import utils.auth_helpers.authenticate;
|
|
37
|
-
\`\`\``
|
|
38
|
-
: ""}
|
|
39
|
-
|
|
40
|
-
if ${language === "python"
|
|
41
|
-
? `IMPORTANT:
|
|
42
|
-
FOR PYTHON:
|
|
43
|
-
- If functions are in different folders, use relative path manipulation with os.path. NEVER hardcode absolute paths:
|
|
44
|
-
\`\`\`python
|
|
45
|
-
import sys
|
|
46
|
-
import os
|
|
47
|
-
# Add parent directory to path to access sibling folders
|
|
48
|
-
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
|
|
49
|
-
from e2e.e2e_test import helper_function
|
|
50
|
-
|
|
51
|
-
# OR if importing from same directory level
|
|
52
|
-
sys.path.append(os.path.dirname(__file__))
|
|
53
|
-
from e2e_test import helper_function
|
|
54
|
-
\`\`\`
|
|
55
|
-
- Use aliases to avoid naming conflicts and prevent test execution:
|
|
56
|
-
\`\`\`python
|
|
57
|
-
# If importing a test file, use alias to prevent auto-execution
|
|
58
|
-
import e2e_test as e2e_helpers
|
|
59
|
-
# Then call: e2e_helpers.setup_auth_headers()
|
|
60
|
-
\`\`\`
|
|
61
|
-
- CRITICAL: When importing test files, they may auto-execute. Use \`if __name__ == "__main__":\` guards in source files.
|
|
62
|
-
`
|
|
63
|
-
: ""}
|
|
64
|
-
|
|
65
|
-
**STEP 3: REPLACE DUPLICATE CODE - MANDATORY**
|
|
66
|
-
You MUST replace duplicate code with imported function calls. If you imported functions, you MUST use them.
|
|
67
|
-
|
|
68
|
-
**STEP 4: CREATE MINIMAL NEW HELPERS (ONLY IF NEEDED)**
|
|
5
|
+
**CRITICAL: DO NOT CHANGE THE FUNCTIONALITY OF THE TESTS. ONLY MODULARIZE THE CODE.**
|
|
69
6
|
Only if NO existing function can be reused:
|
|
70
7
|
1. Group related lines logically (e.g., login steps together) to improve readability and parameterize the test function(s) with meaningful parameters to make it more flexible.
|
|
71
8
|
2. If functions are already modularized (like breakpoint_section_0, breakpoint_section_1), then rename them with meaningful names WITHOUT ANY OTHER CHANGES.
|
|
@@ -25,7 +25,7 @@ export function registerStartTraceCollectionPrompt(mcpServer) {
|
|
|
25
25
|
* To start a playwright trace collection session using agent, run the following command:
|
|
26
26
|
Start playwright trace collection with default settings.
|
|
27
27
|
|
|
28
|
-
**CRITICAL:
|
|
28
|
+
**CRITICAL: NEVER SHOW THE CLI COMMANDS.**
|
|
29
29
|
`,
|
|
30
30
|
},
|
|
31
31
|
},
|
|
@@ -5,6 +5,8 @@ import { Writable } from "stream";
|
|
|
5
5
|
import { logger } from "../utils/logger.js";
|
|
6
6
|
import { stripVTControlCharacters } from "util";
|
|
7
7
|
import fs from "fs";
|
|
8
|
+
const EXECUTOR_DOCKER_IMAGE = "skyramp/executor:v1.2.16";
|
|
9
|
+
const DOCKER_PLATFORM = "linux/amd64";
|
|
8
10
|
export function registerExecuteSkyrampTestTool(server) {
|
|
9
11
|
server.registerTool("skyramp_execute_test", {
|
|
10
12
|
description: `Execute a Skyramp-generated test in isolated containerized environments for reliable, deterministic testing.
|
|
@@ -54,7 +56,6 @@ For detailed documentation visit: https://www.skyramp.dev/docs/quickstart`,
|
|
|
54
56
|
},
|
|
55
57
|
}, async (params) => {
|
|
56
58
|
var docker = new Docker();
|
|
57
|
-
var image = "public.ecr.aws/skyramp/rampup/runner:mcp-v0.0.9";
|
|
58
59
|
const containerMountPath = "/home/user";
|
|
59
60
|
// Use path.basename for safer filename extraction
|
|
60
61
|
const filename = path.basename(params.testFile);
|
|
@@ -116,14 +117,17 @@ For detailed documentation visit: https://www.skyramp.dev/docs/quickstart`,
|
|
|
116
117
|
var statusCode = 0;
|
|
117
118
|
// check if image exists
|
|
118
119
|
const images = await docker.listImages();
|
|
119
|
-
const imageExists = images.some((img) => (img.RepoTags && img.RepoTags.includes(
|
|
120
|
-
(img.RepoDigests &&
|
|
120
|
+
const imageExists = images.some((img) => (img.RepoTags && img.RepoTags.includes(EXECUTOR_DOCKER_IMAGE)) ||
|
|
121
|
+
(img.RepoDigests &&
|
|
122
|
+
img.RepoDigests.includes(EXECUTOR_DOCKER_IMAGE)));
|
|
121
123
|
if (!imageExists) {
|
|
122
124
|
// Pull the image if it does not exist
|
|
123
125
|
await new Promise((resolve, reject) => {
|
|
124
|
-
docker.pull(
|
|
126
|
+
docker.pull(EXECUTOR_DOCKER_IMAGE, { platform: DOCKER_PLATFORM }, (err, stream) => {
|
|
125
127
|
if (err)
|
|
126
128
|
return reject(err);
|
|
129
|
+
if (!stream)
|
|
130
|
+
return reject(new Error("No stream received from docker pull"));
|
|
127
131
|
docker.modem.followProgress(stream, (err, res) => {
|
|
128
132
|
if (err)
|
|
129
133
|
return reject(err);
|
|
@@ -133,7 +137,10 @@ For detailed documentation visit: https://www.skyramp.dev/docs/quickstart`,
|
|
|
133
137
|
});
|
|
134
138
|
}
|
|
135
139
|
await docker
|
|
136
|
-
.run(
|
|
140
|
+
.run(EXECUTOR_DOCKER_IMAGE, command, stream, {
|
|
141
|
+
Env: env,
|
|
142
|
+
HostConfig: hostConfig,
|
|
143
|
+
})
|
|
137
144
|
.then(function (data) {
|
|
138
145
|
var result = data[0];
|
|
139
146
|
var container = data[1];
|
|
@@ -4,7 +4,6 @@ import { z } from "zod";
|
|
|
4
4
|
import { TELEMETRY_entrypoint_FIELD_NAME, } from "../utils/utils.js";
|
|
5
5
|
import { logger } from "../utils/logger.js";
|
|
6
6
|
import { baseSchema } from "../types/TestTypes.js";
|
|
7
|
-
import path from "path";
|
|
8
7
|
import { existsSync, mkdirSync } from "fs";
|
|
9
8
|
export function registerTraceStopTool(server) {
|
|
10
9
|
server.registerTool("skyramp_stop_trace_collection", {
|
|
@@ -59,11 +58,6 @@ For detailed documentation visit: https://www.skyramp.dev/docs/load-test/advance
|
|
|
59
58
|
if (!existsSync(params.outputDir)) {
|
|
60
59
|
mkdirSync(params.outputDir, { recursive: true });
|
|
61
60
|
}
|
|
62
|
-
// Temporary fix until library is updated
|
|
63
|
-
if (params.outputDir) {
|
|
64
|
-
params.traceOutputFile = path.join(params.outputDir, params.traceOutputFile);
|
|
65
|
-
params.playwrightOutput = path.join(params.outputDir, params.playwrightOutput);
|
|
66
|
-
}
|
|
67
61
|
let errList = {
|
|
68
62
|
content: [],
|
|
69
63
|
isError: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyramp/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@modelcontextprotocol/sdk": "^1.11.4",
|
|
45
|
-
"@skyramp/skyramp": "^1.2.
|
|
45
|
+
"@skyramp/skyramp": "^1.2.16",
|
|
46
46
|
"dockerode": "^4.0.6",
|
|
47
47
|
"zod": "^3.25.3"
|
|
48
48
|
},
|