@skyramp/mcp 0.0.20 → 0.0.22

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.
@@ -3,35 +3,38 @@ export function getModularizationPrompt(filePath, language) {
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
5
  **CRITICAL: DO NOT CHANGE THE FUNCTIONALITY OF THE TESTS. ONLY MODULARIZE THE CODE.**
6
+
7
+ **ABSOLUTELY FORBIDDEN: DO NOT CREATE ANY INTERFACES, CLASSES, TYPES, OR NEW DATA STRUCTURES. USE INLINE TYPES ONLY.**
8
+
6
9
  Only if NO existing function can be reused:
7
10
  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.
8
11
  2. If functions are already modularized (like breakpoint_section_0, breakpoint_section_1), then rename them with meaningful names WITHOUT ANY OTHER CHANGES.
9
12
  3. KEEP CHANGES TO A MINIMUM. DO NOT MODIFY THE FUNCTIONALITY OF THE TESTS. ONLY MODULARIZE THE CODE.
10
13
  4. Parameterize the test function(s) with meaningful parameters to make it more flexible. Preserve the original order of code lines within each function.
11
- 5. Only extract reusable logical sections into helper functions or parameterized structures where applicable. Do not create any new test cases or a new modular file but only helper functions with modularization done in the same file. Do not add any new logic or classes or any other files.
12
- 6. CRITICAL: DO NOT CHANGE THE FUNCTIONALITY OF THE TESTS. ONLY MODULARIZE THE CODE.
13
-
14
- **EXECUTION CHECKLIST - YOU MUST COMPLETE EACH:**
15
- - [ ] STEP 1: Searched for existing files using grep_search or file_search
16
- - [ ] STEP 2: Found reusable functions and imported them at the top of the file
17
- - [ ] STEP 3: Replaced duplicate code with imported function calls
18
- - [ ] STEP 4: Created minimal new helpers only where needed
19
- - [ ] Verified import paths are correct
20
- - [ ] Verified original functionality is maintained
14
+ 5. Only extract reusable logical sections into helper functions. Use inline parameter types instead of creating interfaces or type definitions.
15
+ 6. **If extracting UI operations, ensure each helper function is self-contained** and leaves the UI in a clean state for the next operation WITHOUT UPDATING THE LOGIC OF THE TESTS.
21
16
 
22
- **CRITICAL: If you skip any step, the modularization is incomplete. You MUST complete all steps before proceeding.**
17
+ **CRITICAL CONSTRAINTS:**
18
+ - NO interfaces, classes, types, or data structures
19
+ - NO new test cases or logic
20
+ - NO additional files
21
+ - ONLY helper functions with inline types
22
+ - PRESERVE original functionality exactly
23
23
 
24
- **CRITICAL: FIX ERRORS IN MODULARIZED CODE USING skyramp_fix_errors TOOL**
24
+ **CRITICAL: If you skip any step, the modularization is incomplete. You MUST complete all steps before proceeding.FIX ERRORS IN MODULARIZED CODE USING skyramp_fix_errors TOOL**
25
25
  `;
26
26
  }
27
27
  export function getFixErrorsPrompt() {
28
28
  return `
29
29
  **Fix errors in refactored code.**
30
30
 
31
- 1. **Parameter Passing:** Identify functions using variables from outside scope (like Playwright 'page' object). Pass these as parameters.
31
+ 1. **Parameter Passing:** Identify functions using variables from outside scope (like 'page' object). Pass these as parameters.
32
32
  2. **Validate Correctness:** Ensure code is free of reference errors, undefined variables, runtime issues.
33
33
  3. **Import Paths:** Ensure import paths are correct and there are no circular imports.
34
+ 4. **UI State Management:** Check for UI state conflicts, modal interference, or element interaction issues.
35
+ 5. **Sequential Operations:** Ensure UI operations don't interfere with each other when called in sequence.
34
36
 
35
37
  **KEY: Variables not defined within function scope MUST be passed as parameters.**
38
+ **UI KEY: Helper functions that perform UI operations must be self-contained and not leave modals/dialogs open.**
36
39
  `;
37
40
  }
@@ -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: FOR UI TESTS ALWAYS SHOW THE ABOVE PROMPT FOR PLAYWRIGHT TRACE COLLECTION. NEVER SHOW THE CLI COMMANDS.**
28
+ **CRITICAL: NEVER SHOW THE CLI COMMANDS.**
29
29
  `,
30
30
  },
31
31
  },
@@ -92,7 +92,7 @@ Let us generate an E2E test with backend trace file skyramp-traces.json and fron
92
92
  \`\`\`
93
93
 
94
94
  **UI TEST:**
95
- - Purpose: Generate UI tests using Playwright traces
95
+ - Purpose: Generate UI tests using Playwright traces captured using skyramp_start_trace_collection tool
96
96
  - Requirements: A frontend playwright trace file, test language, test framework
97
97
 
98
98
  **Sample UI Test Prompt:**
@@ -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(image)) ||
120
- (img.RepoDigests && img.RepoDigests.includes(image)));
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(image, (err, stream) => {
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(image, command, stream, { Env: env, HostConfig: hostConfig })
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];
@@ -6,7 +6,7 @@ const e2eTestSchema = {
6
6
  ...baseTraceSchema.shape,
7
7
  playwrightInput: z
8
8
  .string()
9
- .describe("MUST be absolute path to the playwright input file like /path/to/playwright-ui-test.zip and MUST be a zip file"),
9
+ .describe("MUST be absolute path to the playwright input file like /path/to/playwright-ui-test.zip and MUST be a zip file captured using start_trace_collection tool"),
10
10
  };
11
11
  export class E2ETestService extends TestGenerationService {
12
12
  getTestType() {
@@ -30,7 +30,7 @@ export function registerE2ETestTool(server) {
30
30
  End-to-End tests validate complete user journeys by testing the entire application flow from frontend UI interactions to backend API responses. They ensure that all components work together correctly in realistic user scenarios, providing the highest confidence in application functionality.
31
31
 
32
32
  TRACE & UI INTEGRATION:
33
- E2E tests require both trace files (capturing backend API interactions) and Playwright recordings (capturing UI interactions) to generate comprehensive tests that validate the complete user experience.`,
33
+ E2E tests require both trace files (capturing backend API interactions) and Playwright recordings (capturing UI interactions captured using start_trace_collection tool) to generate comprehensive tests that validate the complete user experience.`,
34
34
  inputSchema: e2eTestSchema,
35
35
  annotations: {
36
36
  keywords: ["e2e test", "end-to-end test"],
@@ -21,7 +21,7 @@ const uiTestSchema = {
21
21
  ...languageSchema.shape,
22
22
  playwrightInput: z
23
23
  .string()
24
- .describe("MUST be absolute path to the playwright input file like /path/to/playwright-ui-test.zip and MUST be a zip file"),
24
+ .describe("MUST be absolute path to the playwright input file like /path/to/playwright-ui-test.zip and MUST be a zip file captured using start_trace_collection tool"),
25
25
  output: baseSchema.shape.output,
26
26
  outputDir: baseSchema.shape.outputDir,
27
27
  force: baseSchema.shape.force,
@@ -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
- stopTraceOptions.output = path.join(stopTraceOptions.outputDir, stopTraceOptions.output);
65
- stopTraceOptions.playwrightOutput = path.join(stopTraceOptions.outputDir, stopTraceOptions.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.20",
3
+ "version": "0.0.22",
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.15",
45
+ "@skyramp/skyramp": "^1.2.16",
46
46
  "dockerode": "^4.0.6",
47
47
  "zod": "^3.25.3"
48
48
  },