@skyramp/mcp 0.0.33 → 0.0.35
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/build/index.js +45 -33
- package/build/prompts/modularization/integration-test-modularization.js +2 -1
- package/build/prompts/modularization/ui-test-modularization.js +2 -1
- package/build/prompts/testGenerationPrompt.js +3 -0
- package/build/services/ModularizationService.js +6 -1
- package/build/services/ScenarioGenerationService.js +1 -14
- package/build/services/TestGenerationService.js +7 -0
- package/build/tools/__tests__/codeReuseTool.test.js +1 -1
- package/build/tools/{loginTool.js → auth/loginTool.js} +1 -1
- package/build/tools/{logoutTool.js → auth/logoutTool.js} +1 -1
- package/build/tools/{codeReuseTool.js → code-refactor/codeReuseTool.js} +12 -11
- package/build/tools/{modularizationTool.js → code-refactor/modularizationTool.js} +4 -4
- package/build/tools/executeSkyrampTestTool.js +1 -1
- package/build/tools/{generateContractRestTool.js → generate-tests/generateContractRestTool.js} +2 -2
- package/build/tools/{generateE2ERestTool.js → generate-tests/generateE2ERestTool.js} +2 -2
- package/build/tools/{generateFuzzRestTool.js → generate-tests/generateFuzzRestTool.js} +2 -2
- package/build/tools/{generateIntegrationRestTool.js → generate-tests/generateIntegrationRestTool.js} +10 -5
- package/build/tools/{generateLoadRestTool.js → generate-tests/generateLoadRestTool.js} +2 -2
- package/build/tools/{generateScenarioRestTool.js → generate-tests/generateScenarioRestTool.js} +5 -2
- package/build/tools/{generateSmokeRestTool.js → generate-tests/generateSmokeRestTool.js} +2 -2
- package/build/tools/{generateUIRestTool.js → generate-tests/generateUIRestTool.js} +8 -2
- package/build/tools/{startTraceCollectionTool.js → trace/startTraceCollectionTool.js} +3 -3
- package/build/tools/{stopTraceCollectionTool.js → trace/stopTraceCollectionTool.js} +4 -4
- package/build/types/TestTypes.js +3 -2
- package/package.json +2 -2
package/build/index.js
CHANGED
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { registerStartTraceCollectionPrompt } from "./prompts/startTraceCollectionPrompts.js";
|
|
5
|
-
import { registerTraceTool } from "./tools/startTraceCollectionTool.js";
|
|
6
|
-
import { registerTraceStopTool } from "./tools/stopTraceCollectionTool.js";
|
|
5
|
+
import { registerTraceTool } from "./tools/trace/startTraceCollectionTool.js";
|
|
6
|
+
import { registerTraceStopTool } from "./tools/trace/stopTraceCollectionTool.js";
|
|
7
7
|
import { registerExecuteSkyrampTestTool } from "./tools/executeSkyrampTestTool.js";
|
|
8
8
|
import { registerTestGenerationPrompt } from "./prompts/testGenerationPrompt.js";
|
|
9
9
|
import { logger } from "./utils/logger.js";
|
|
10
|
-
import { registerUITestTool } from "./tools/generateUIRestTool.js";
|
|
11
|
-
import { registerSmokeTestTool } from "./tools/generateSmokeRestTool.js";
|
|
12
|
-
import { registerFuzzTestTool } from "./tools/generateFuzzRestTool.js";
|
|
13
|
-
import { registerContractTestTool } from "./tools/generateContractRestTool.js";
|
|
14
|
-
import { registerLoadTestTool } from "./tools/generateLoadRestTool.js";
|
|
15
|
-
import { registerIntegrationTestTool } from "./tools/generateIntegrationRestTool.js";
|
|
16
|
-
import { registerE2ETestTool } from "./tools/generateE2ERestTool.js";
|
|
17
|
-
import { registerLoginTool } from "./tools/loginTool.js";
|
|
18
|
-
import { registerLogoutTool } from "./tools/logoutTool.js";
|
|
10
|
+
import { registerUITestTool } from "./tools/generate-tests/generateUIRestTool.js";
|
|
11
|
+
import { registerSmokeTestTool } from "./tools/generate-tests/generateSmokeRestTool.js";
|
|
12
|
+
import { registerFuzzTestTool } from "./tools/generate-tests/generateFuzzRestTool.js";
|
|
13
|
+
import { registerContractTestTool } from "./tools/generate-tests/generateContractRestTool.js";
|
|
14
|
+
import { registerLoadTestTool } from "./tools/generate-tests/generateLoadRestTool.js";
|
|
15
|
+
import { registerIntegrationTestTool } from "./tools/generate-tests/generateIntegrationRestTool.js";
|
|
16
|
+
import { registerE2ETestTool } from "./tools/generate-tests/generateE2ERestTool.js";
|
|
17
|
+
import { registerLoginTool } from "./tools/auth/loginTool.js";
|
|
18
|
+
import { registerLogoutTool } from "./tools/auth/logoutTool.js";
|
|
19
19
|
import { registerFixErrorTool } from "./tools/fixErrorTool.js";
|
|
20
|
-
import { registerModularizationTool } from "./tools/modularizationTool.js";
|
|
21
|
-
import { registerCodeReuseTool } from "./tools/codeReuseTool.js";
|
|
22
|
-
import { registerScenarioTestTool } from "./tools/generateScenarioRestTool.js";
|
|
20
|
+
import { registerModularizationTool } from "./tools/code-refactor/modularizationTool.js";
|
|
21
|
+
import { registerCodeReuseTool } from "./tools/code-refactor/codeReuseTool.js";
|
|
22
|
+
import { registerScenarioTestTool } from "./tools/generate-tests/generateScenarioRestTool.js";
|
|
23
23
|
const server = new McpServer({
|
|
24
24
|
name: "Skyramp MCP Server",
|
|
25
25
|
version: "1.0.0",
|
|
@@ -34,28 +34,40 @@ const server = new McpServer({
|
|
|
34
34
|
});
|
|
35
35
|
// Register prompts
|
|
36
36
|
logger.info("Starting prompt registration process");
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
const prompts = [
|
|
38
|
+
registerTestGenerationPrompt,
|
|
39
|
+
registerStartTraceCollectionPrompt,
|
|
40
|
+
];
|
|
41
|
+
prompts.forEach((registerPrompt) => registerPrompt(server));
|
|
39
42
|
logger.info("All prompts registered successfully");
|
|
40
43
|
// Register test generation tools
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
const testGenerationTools = [
|
|
45
|
+
registerSmokeTestTool,
|
|
46
|
+
registerFuzzTestTool,
|
|
47
|
+
registerContractTestTool,
|
|
48
|
+
registerLoadTestTool,
|
|
49
|
+
registerIntegrationTestTool,
|
|
50
|
+
registerE2ETestTool,
|
|
51
|
+
registerUITestTool,
|
|
52
|
+
registerScenarioTestTool,
|
|
53
|
+
];
|
|
54
|
+
testGenerationTools.forEach((registerTool) => registerTool(server));
|
|
55
|
+
// Register modularization and code quality tools
|
|
56
|
+
const codeQualityTools = [
|
|
57
|
+
registerModularizationTool,
|
|
58
|
+
registerFixErrorTool,
|
|
59
|
+
registerCodeReuseTool,
|
|
60
|
+
];
|
|
61
|
+
codeQualityTools.forEach((registerTool) => registerTool(server));
|
|
53
62
|
// Register other Skyramp tools
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
const infrastructureTools = [
|
|
64
|
+
registerLoginTool,
|
|
65
|
+
registerLogoutTool,
|
|
66
|
+
registerExecuteSkyrampTestTool,
|
|
67
|
+
registerTraceTool,
|
|
68
|
+
registerTraceStopTool,
|
|
69
|
+
];
|
|
70
|
+
infrastructureTools.forEach((registerTool) => registerTool(server));
|
|
59
71
|
// Start MCP server
|
|
60
72
|
async function main() {
|
|
61
73
|
const transport = new StdioServerTransport();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export function getModularizationPrompt(filePath) {
|
|
2
2
|
return `# INTEGRATION TEST MODULARIZATION - SIMPLE AND SAFE
|
|
3
3
|
|
|
4
|
-
**
|
|
4
|
+
**CRITICAL: Use the 'write' tool to save the modularized code to: ${filePath}**
|
|
5
|
+
**DO NOT use search_replace - use the 'write' tool to overwrite the entire file with the modularized version**
|
|
5
6
|
|
|
6
7
|
**ABSOLUTELY FORBIDDEN:**
|
|
7
8
|
- DO NOT CREATE ANY INTERFACES, CLASSES, TYPES, OR NEW DATA STRUCTURES. USE INLINE TYPES ONLY.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export function getModularizationPrompt(filePath) {
|
|
2
2
|
return `# UI TEST MODULARIZATION - IMPROVE READABILITY AND REDUCE DUPLICATION
|
|
3
3
|
|
|
4
|
-
**
|
|
4
|
+
**CRITICAL: Use the 'write' tool to save the modularized code to: ${filePath}**
|
|
5
|
+
**DO NOT use search_replace - use the 'write' tool to overwrite the entire file with the modularized version**
|
|
5
6
|
|
|
6
7
|
**ABSOLUTELY FORBIDDEN:**
|
|
7
8
|
- DO NOT CREATE INTERFACES, CLASSES, TYPES, NEW FILES, OR NEW DATA STRUCTURES
|
|
@@ -16,6 +16,7 @@ export function registerTestGenerationPrompt(mcpServer) {
|
|
|
16
16
|
- Answer questions about Skyramp capabilities and testing concepts
|
|
17
17
|
- ALWAYS SHOW STEPS TO GENERATE TEST USING MCP TOOLS AND NEVER SHOW THE CLI COMMANDS.
|
|
18
18
|
- CRITICAL: UI, INTEGRATION, E2E TESTS MUST BE MODULARIZED USING skyramp_modularization TOOL. ALWAYS ADD A TASK TO MODULARIZE THE TEST USING skyramp_modularization TOOL AFTER GENERATING THESE(UI, INTEGRATION, E2E) TESTS.
|
|
19
|
+
- **CRITICAL: skyramp_reuse_code TOOL MUST BE CALLED IF DURING THE TEST GENERATION THE CODE REUSE FLAG IS SET TO TRUE EXPLICITLY BY THE USER.**
|
|
19
20
|
|
|
20
21
|
**CONTRACT TEST:**
|
|
21
22
|
- Purpose: Ensures a service is properly communicating with another service
|
|
@@ -185,6 +186,8 @@ Trace File:
|
|
|
185
186
|
- FOR SCENARIO PARSING, ALWAYS REQUIRE AN API SCHEMA FOR ACCURATE ENDPOINT MAPPING.
|
|
186
187
|
- SCENARIO PARSING ONLY RETURNS JSON ARRAYS - USE OTHER TOOLS FOR ACTUAL TEST GENERATION.
|
|
187
188
|
|
|
189
|
+
**CRITICAL: FOR A SINGLE SCENARIO CREATE A SINGLE SCENARIO FILE WITH EACH STEP AS A JSON OBJECT IN THE ARRAY.**
|
|
190
|
+
|
|
188
191
|
**CRITICAL: SHOW STEPS TO START/STOP PLAYWRIGHT TRACE COLLECTION FOR UI TESTS. NEVER SHOW THE CLI COMMANDS.**
|
|
189
192
|
`,
|
|
190
193
|
},
|
|
@@ -29,7 +29,12 @@ export class ModularizationService {
|
|
|
29
29
|
content: [
|
|
30
30
|
{
|
|
31
31
|
type: "text",
|
|
32
|
-
text: prompt
|
|
32
|
+
text: prompt +
|
|
33
|
+
`\n\n***CRITICAL INSTRUCTIONS:***
|
|
34
|
+
1. Read the test file using the 'read_file' tool
|
|
35
|
+
2. Create the modularized version following the instructions above
|
|
36
|
+
3. Use the 'write' tool (NOT search_replace) to save the complete modularized code to the file
|
|
37
|
+
4. After modularization is complete, proceed to skyramp_fix_errors tool if there are any errors`,
|
|
33
38
|
},
|
|
34
39
|
],
|
|
35
40
|
};
|
|
@@ -118,7 +118,7 @@ ${JSON.stringify(traceRequest, null, 2)}
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
generateTraceRequestFromInput(params) {
|
|
121
|
-
const destination =
|
|
121
|
+
const destination = params.destination;
|
|
122
122
|
// Use AI-provided parameters instead of parsing
|
|
123
123
|
const timestamp = new Date().toISOString();
|
|
124
124
|
const method = params.method;
|
|
@@ -151,17 +151,4 @@ ${JSON.stringify(traceRequest, null, 2)}
|
|
|
151
151
|
Scheme: "https",
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
|
-
extractDestinationFromSchema(apiSchema) {
|
|
155
|
-
// If it's a URL, extract destination; if it's a file path, use default
|
|
156
|
-
if (apiSchema.startsWith("http")) {
|
|
157
|
-
try {
|
|
158
|
-
const url = new URL(apiSchema);
|
|
159
|
-
return url.host;
|
|
160
|
-
}
|
|
161
|
-
catch {
|
|
162
|
-
return "api.example.com";
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return "api.example.com";
|
|
166
|
-
}
|
|
167
154
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SkyrampClient } from "@skyramp/skyramp";
|
|
2
2
|
import { analyzeOpenAPIWithGivenEndpoint } from "../utils/analyze-openapi.js";
|
|
3
|
+
import * as fs from "fs";
|
|
3
4
|
import { getPathParameterValidationError, OUTPUT_DIR_FIELD_NAME, PATH_PARAMS_FIELD_NAME, QUERY_PARAMS_FIELD_NAME, FORM_PARAMS_FIELD_NAME, validateParams, validatePath, validateRequestData, TELEMETRY_entrypoint_FIELD_NAME, } from "../utils/utils.js";
|
|
4
5
|
import { getLanguageSteps } from "../utils/language-helper.js";
|
|
5
6
|
import { logger } from "../utils/logger.js";
|
|
@@ -26,6 +27,11 @@ export class TestGenerationService {
|
|
|
26
27
|
if (apiAnalysisResult) {
|
|
27
28
|
return apiAnalysisResult;
|
|
28
29
|
}
|
|
30
|
+
if (params.scenarioFile) {
|
|
31
|
+
//read file and convert and pass to generateOptions as `rawTrace`
|
|
32
|
+
const scenarioFile = await fs.promises.readFile(params.scenarioFile, "utf8");
|
|
33
|
+
generateOptions.rawTrace = scenarioFile;
|
|
34
|
+
}
|
|
29
35
|
const result = await this.executeGeneration(generateOptions);
|
|
30
36
|
const testType = this.getTestType();
|
|
31
37
|
const languageSteps = getLanguageSteps({
|
|
@@ -188,6 +194,7 @@ ${result}`;
|
|
|
188
194
|
generateExclude: params.exclude,
|
|
189
195
|
generateInsecure: params.insecure,
|
|
190
196
|
entrypoint: TELEMETRY_entrypoint_FIELD_NAME,
|
|
197
|
+
chainingKey: params.chainingKey,
|
|
191
198
|
};
|
|
192
199
|
}
|
|
193
200
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, jest } from "@jest/globals";
|
|
2
|
-
import { registerCodeReuseTool } from "../codeReuseTool.js";
|
|
2
|
+
import { registerCodeReuseTool } from "../code-refactor/codeReuseTool.js";
|
|
3
3
|
import { getCodeReusePrompt } from "../../prompts/code-reuse.js";
|
|
4
4
|
// Mock the logger
|
|
5
5
|
jest.mock("../../utils/logger", () => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { SkyrampClient } from "@skyramp/skyramp";
|
|
3
|
-
import { logger } from "
|
|
3
|
+
import { logger } from "../../utils/logger.js";
|
|
4
4
|
export function registerLoginTool(server) {
|
|
5
5
|
server.registerTool("skyramp_login", {
|
|
6
6
|
description: `Login to Skyramp platform
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { SkyrampClient } from "@skyramp/skyramp";
|
|
3
|
-
import { logger } from "
|
|
3
|
+
import { logger } from "../../utils/logger.js";
|
|
4
4
|
export function registerLogoutTool(server) {
|
|
5
5
|
server.registerTool("skyramp_logout", {
|
|
6
6
|
description: `Logout from Skyramp platform
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { logger } from "
|
|
3
|
-
import { getCodeReusePrompt } from "
|
|
4
|
-
import { codeRefactoringSchema, languageSchema } from "
|
|
5
|
-
import { SKYRAMP_UTILS_HEADER } from "
|
|
2
|
+
import { logger } from "../../utils/logger.js";
|
|
3
|
+
import { getCodeReusePrompt } from "../../prompts/code-reuse.js";
|
|
4
|
+
import { codeRefactoringSchema, languageSchema, } from "../../types/TestTypes.js";
|
|
5
|
+
import { SKYRAMP_UTILS_HEADER } from "../../utils/utils.js";
|
|
6
6
|
const codeReuseSchema = z.object({
|
|
7
7
|
testFile: z
|
|
8
8
|
.string()
|
|
@@ -21,13 +21,14 @@ export function registerCodeReuseTool(server) {
|
|
|
21
21
|
This tool helps identify and reuse ONLY EXISTING helper functions from other test files (grep based on "${SKYRAMP_UTILS_HEADER}").
|
|
22
22
|
|
|
23
23
|
**CRITICAL RULES - VIOLATION WILL RESULT IN ERROR:**
|
|
24
|
-
1.
|
|
25
|
-
2.
|
|
26
|
-
3.
|
|
27
|
-
4. DO NOT
|
|
28
|
-
5.
|
|
29
|
-
6.
|
|
30
|
-
7.
|
|
24
|
+
1. THIS TOOL MUST BE CALLED IF DURING THE TEST GENERATION THE CODE REUSE FLAG IS SET TO TRUE EXPLICITLY
|
|
25
|
+
2. DO NOT create new helper functions - only find and reuse existing ones
|
|
26
|
+
3. ONLY create a utils file if ACTUAL helper functions (with signatures) exist in OTHER test files
|
|
27
|
+
4. DO NOT create utils files for repetitive patterns - that's refactoring, not reuse
|
|
28
|
+
5. DO NOT extract patterns from current or other test files - only move existing functions
|
|
29
|
+
6. If other test files are identical/similar with no helper functions, DO NOTHING
|
|
30
|
+
7. Helper functions must have explicit function definitions, not just patterns
|
|
31
|
+
8. If no existing helper functions found, test file remains unchanged
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
**WORKFLOW SUMMARY:**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { logger } from "
|
|
3
|
-
import { TestType } from "
|
|
4
|
-
import { ModularizationService, } from "
|
|
2
|
+
import { logger } from "../../utils/logger.js";
|
|
3
|
+
import { TestType } from "../../types/TestTypes.js";
|
|
4
|
+
import { ModularizationService, } from "../../services/ModularizationService.js";
|
|
5
5
|
const modularizationSchema = {
|
|
6
6
|
testFile: z
|
|
7
7
|
.string()
|
|
@@ -9,7 +9,7 @@ const modularizationSchema = {
|
|
|
9
9
|
language: z.string().describe("The programming language of the test file"),
|
|
10
10
|
testType: z
|
|
11
11
|
.enum([TestType.UI, TestType.E2E, TestType.INTEGRATION])
|
|
12
|
-
.describe("Specifies the type of test (UI, E2E, or Integration)"),
|
|
12
|
+
.describe("Specifies the type of test (UI, E2E, or Integration). DO NOT USE TEST NAME/DESCRIPTION AS TEST TYPE. ONLY USE UI, E2E, OR INTEGRATION."),
|
|
13
13
|
prompt: z
|
|
14
14
|
.string()
|
|
15
15
|
.describe("The prompt or code content to process with modularization principles applied"),
|
|
@@ -5,7 +5,7 @@ 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.
|
|
8
|
+
const EXECUTOR_DOCKER_IMAGE = "skyramp/executor:v1.2.27";
|
|
9
9
|
const DOCKER_PLATFORM = "linux/amd64";
|
|
10
10
|
export function registerExecuteSkyrampTestTool(server) {
|
|
11
11
|
server.registerTool("skyramp_execute_test", {
|
package/build/tools/{generateContractRestTool.js → generate-tests/generateContractRestTool.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { baseTestSchema, TestType } from "
|
|
3
|
-
import { TestGenerationService, } from "
|
|
2
|
+
import { baseTestSchema, TestType } from "../../types/TestTypes.js";
|
|
3
|
+
import { TestGenerationService, } from "../../services/TestGenerationService.js";
|
|
4
4
|
const contractTestSchema = {
|
|
5
5
|
...baseTestSchema,
|
|
6
6
|
assertOptions: z
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { baseSchema, baseTraceSchema, TestType, codeRefactoringSchema, } from "
|
|
3
|
-
import { TestGenerationService, } from "
|
|
2
|
+
import { baseSchema, baseTraceSchema, TestType, codeRefactoringSchema, } from "../../types/TestTypes.js";
|
|
3
|
+
import { TestGenerationService, } from "../../services/TestGenerationService.js";
|
|
4
4
|
const e2eTestSchema = {
|
|
5
5
|
...baseTraceSchema.shape,
|
|
6
6
|
playwrightInput: z
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { baseTestSchema, TestType } from "
|
|
2
|
-
import { TestGenerationService, } from "
|
|
1
|
+
import { baseTestSchema, TestType } from "../../types/TestTypes.js";
|
|
2
|
+
import { TestGenerationService, } from "../../services/TestGenerationService.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
const fuzzTestSchema = {
|
|
5
5
|
...baseTestSchema,
|
package/build/tools/{generateIntegrationRestTool.js → generate-tests/generateIntegrationRestTool.js}
RENAMED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { baseTestSchema, baseTraceSchema, TestType, codeRefactoringSchema, } from "
|
|
3
|
-
import { TestGenerationService, } from "
|
|
2
|
+
import { baseTestSchema, baseTraceSchema, TestType, codeRefactoringSchema, } from "../../types/TestTypes.js";
|
|
3
|
+
import { TestGenerationService, } from "../../services/TestGenerationService.js";
|
|
4
4
|
const integrationTestSchema = z
|
|
5
5
|
.object({
|
|
6
6
|
...baseTestSchema,
|
|
7
|
+
chainingKey: z
|
|
8
|
+
.string()
|
|
9
|
+
.optional()
|
|
10
|
+
.describe("JSON path of POST response that will be used for chaining. Example: If asked to use item_id to chain the requests, please ensure chainingKey is set to item_id."),
|
|
7
11
|
trace: baseTraceSchema.shape.trace.optional(),
|
|
8
12
|
include: baseTraceSchema.shape.include.optional(),
|
|
9
13
|
exclude: baseTraceSchema.shape.exclude.optional(),
|
|
10
14
|
endpointURL: baseTestSchema.endpointURL.default(""),
|
|
11
15
|
...codeRefactoringSchema.shape,
|
|
12
|
-
|
|
16
|
+
scenarioFile: z
|
|
13
17
|
.string()
|
|
14
|
-
.describe("
|
|
18
|
+
.describe("Path to the scenario file to be used for test generation. This file is generated by the skyramp_scenario_test_generation tool.")
|
|
19
|
+
.optional(),
|
|
15
20
|
})
|
|
16
21
|
.omit({ method: true }).shape;
|
|
17
22
|
export class IntegrationTestService extends TestGenerationService {
|
|
@@ -23,7 +28,7 @@ export class IntegrationTestService extends TestGenerationService {
|
|
|
23
28
|
...super.buildBaseGenerationOptions(params),
|
|
24
29
|
responseData: params.responseData,
|
|
25
30
|
playwrightInput: params.playwrightInput,
|
|
26
|
-
|
|
31
|
+
scenarioFile: params.scenarioFile,
|
|
27
32
|
};
|
|
28
33
|
}
|
|
29
34
|
async handleApiAnalysis(params, generateOptions) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { baseTestSchema, baseTraceSchema, TestType, } from "
|
|
3
|
-
import { TestGenerationService, } from "
|
|
2
|
+
import { baseTestSchema, baseTraceSchema, TestType, } from "../../types/TestTypes.js";
|
|
3
|
+
import { TestGenerationService, } from "../../services/TestGenerationService.js";
|
|
4
4
|
const loadTestSchema = {
|
|
5
5
|
...baseTestSchema,
|
|
6
6
|
loadCount: z
|
package/build/tools/{generateScenarioRestTool.js → generate-tests/generateScenarioRestTool.js}
RENAMED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { ScenarioGenerationService } from "
|
|
3
|
-
import { baseSchema } from "
|
|
2
|
+
import { ScenarioGenerationService } from "../../services/ScenarioGenerationService.js";
|
|
3
|
+
import { baseSchema } from "../../types/TestTypes.js";
|
|
4
4
|
const scenarioTestSchema = {
|
|
5
5
|
scenarioName: z
|
|
6
6
|
.string()
|
|
7
7
|
.describe("Name of the test scenario with multiple steps. Describe the complete workflow you want to test, including all actions and their sequence.KEEP IT SHORT AND DESCRIPTIVE AS USED FOR FILE NAME"),
|
|
8
|
+
destination: z
|
|
9
|
+
.string()
|
|
10
|
+
.describe("Destination host (e.g., api.example.com) to be used for the test"),
|
|
8
11
|
apiSchema: z
|
|
9
12
|
.string()
|
|
10
13
|
.describe("MUST be absolute path (/path/to/openapi.json) to the OpenAPI/Swagger schema file or a URL to the OpenAPI/Swagger schema file (e.g. https://demoshop.skyramp.dev/openapi.json). Required for accurate API mapping."),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { baseTestSchema, TestType } from "
|
|
2
|
-
import { TestGenerationService, } from "
|
|
1
|
+
import { baseTestSchema, TestType } from "../../types/TestTypes.js";
|
|
2
|
+
import { TestGenerationService, } from "../../services/TestGenerationService.js";
|
|
3
3
|
import z from "zod";
|
|
4
4
|
// Concrete implementations for each test type
|
|
5
5
|
export class SmokeTestService extends TestGenerationService {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { baseSchema, languageSchema, TestType, codeRefactoringSchema, } from "
|
|
1
|
+
import { baseSchema, languageSchema, TestType, codeRefactoringSchema, baseTraceSchema, } from "../../types/TestTypes.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { TestGenerationService, } from "
|
|
3
|
+
import { TestGenerationService, } from "../../services/TestGenerationService.js";
|
|
4
4
|
export class UITestService extends TestGenerationService {
|
|
5
5
|
getTestType() {
|
|
6
6
|
return TestType.UI;
|
|
@@ -22,6 +22,12 @@ const uiTestSchema = {
|
|
|
22
22
|
playwrightInput: z
|
|
23
23
|
.string()
|
|
24
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
|
+
include: baseTraceSchema.shape.include
|
|
26
|
+
.optional()
|
|
27
|
+
.describe("Array of FQDN strings to only include from trace data when correlating frontend actions with backend calls"),
|
|
28
|
+
exclude: baseTraceSchema.shape.exclude
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Array of FQDN strings to exclude from trace data when correlating frontend actions with backend calls"),
|
|
25
31
|
output: baseSchema.shape.output,
|
|
26
32
|
outputDir: baseSchema.shape.outputDir,
|
|
27
33
|
force: baseSchema.shape.force,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { SkyrampClient } from "@skyramp/skyramp";
|
|
3
|
-
import openProxyTerminalTracked from "
|
|
4
|
-
import { TELEMETRY_entrypoint_FIELD_NAME } from "
|
|
5
|
-
import { logger } from "
|
|
3
|
+
import openProxyTerminalTracked from "../../utils/proxy-terminal.js";
|
|
4
|
+
import { TELEMETRY_entrypoint_FIELD_NAME } from "../../utils/utils.js";
|
|
5
|
+
import { logger } from "../../utils/logger.js";
|
|
6
6
|
export function registerTraceTool(server) {
|
|
7
7
|
server.registerTool("skyramp_start_trace_collection", {
|
|
8
8
|
description: `Start trace collection using Skyramp's comprehensive tracing capabilities.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SkyrampClient } from "@skyramp/skyramp";
|
|
2
|
-
import { closeProxyTerminal } from "
|
|
2
|
+
import { closeProxyTerminal } from "../../utils/proxy-terminal.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { TELEMETRY_entrypoint_FIELD_NAME } from "
|
|
5
|
-
import { logger } from "
|
|
6
|
-
import { baseSchema } from "
|
|
4
|
+
import { TELEMETRY_entrypoint_FIELD_NAME } from "../../utils/utils.js";
|
|
5
|
+
import { logger } from "../../utils/logger.js";
|
|
6
|
+
import { baseSchema } from "../../types/TestTypes.js";
|
|
7
7
|
import { existsSync, mkdirSync } from "fs";
|
|
8
8
|
export function registerTraceStopTool(server) {
|
|
9
9
|
server.registerTool("skyramp_stop_trace_collection", {
|
package/build/types/TestTypes.js
CHANGED
|
@@ -61,6 +61,7 @@ export const baseSchema = z.object({
|
|
|
61
61
|
.describe("MUST be absolute path to the directory where test files will be generated. If not provided, the CURRENT WORKING DIRECTORY will be used WITHOUT ANY SUBDIRECTORIES"),
|
|
62
62
|
force: z
|
|
63
63
|
.boolean()
|
|
64
|
+
.default(true)
|
|
64
65
|
.describe("Whether to overwrite existing files in the output directory"),
|
|
65
66
|
prompt: z.string().describe("The prompt user provided to generate the test"),
|
|
66
67
|
});
|
|
@@ -71,11 +72,11 @@ export const baseTraceSchema = z.object({
|
|
|
71
72
|
include: z
|
|
72
73
|
.array(z.string())
|
|
73
74
|
.default([])
|
|
74
|
-
.describe("List of endpoints or patterns to include in test generation.
|
|
75
|
+
.describe("List of endpoints or patterns to include in test generation."),
|
|
75
76
|
exclude: z
|
|
76
77
|
.array(z.string())
|
|
77
78
|
.default([])
|
|
78
|
-
.describe("List of endpoints or patterns to exclude from test generation.
|
|
79
|
+
.describe("List of endpoints or patterns to exclude from test generation."),
|
|
79
80
|
...baseSchema.shape,
|
|
80
81
|
});
|
|
81
82
|
// Base schema that all test tools share
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyramp/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
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.27",
|
|
46
46
|
"@playwright/test": "^1.55.0",
|
|
47
47
|
"dockerode": "^4.0.6",
|
|
48
48
|
"zod": "^3.25.3"
|