@skyramp/mcp 0.0.65 → 0.1.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/build/playwright/traceRecordingPrompt.js +30 -36
  2. package/build/prompts/architectPersona.js +19 -0
  3. package/build/prompts/test-maintenance/drift-analysis-prompt.js +11 -6
  4. package/build/prompts/test-maintenance/drift-analysis-prompt.test.js +49 -0
  5. package/build/prompts/test-maintenance/driftAnalysisSections.js +4 -2
  6. package/build/prompts/test-recommendation/analysisOutputPrompt.js +42 -50
  7. package/build/prompts/test-recommendation/mergeEnrichedScenarios.test.js +125 -0
  8. package/build/prompts/test-recommendation/recommendationSections.js +121 -4
  9. package/build/prompts/test-recommendation/registerRecommendTestsPrompt.js +151 -9
  10. package/build/prompts/test-recommendation/test-recommendation-prompt.js +416 -61
  11. package/build/prompts/test-recommendation/test-recommendation-prompt.test.js +455 -63
  12. package/build/prompts/testbot/testbot-prompts.js +111 -100
  13. package/build/prompts/testbot/testbot-prompts.test.js +142 -0
  14. package/build/resources/analysisResources.js +13 -5
  15. package/build/services/ScenarioGenerationService.js +2 -2
  16. package/build/services/ScenarioGenerationService.test.js +35 -0
  17. package/build/services/TestExecutionService.js +1 -1
  18. package/build/tools/code-refactor/modularizationTool.js +2 -2
  19. package/build/tools/executeSkyrampTestTool.js +4 -3
  20. package/build/tools/generate-tests/generateBatchScenarioRestTool.js +51 -21
  21. package/build/tools/generate-tests/generateContractRestTool.js +26 -4
  22. package/build/tools/generate-tests/generateIntegrationRestTool.js +44 -13
  23. package/build/tools/generate-tests/generateScenarioRestTool.js +17 -39
  24. package/build/tools/generate-tests/generateUIRestTool.js +69 -4
  25. package/build/tools/submitReportTool.js +27 -13
  26. package/build/tools/test-management/analyzeChangesTool.js +32 -10
  27. package/build/tools/test-management/analyzeChangesTool.test.js +85 -0
  28. package/build/types/RepositoryAnalysis.js +25 -3
  29. package/build/types/TestRecommendation.js +5 -4
  30. package/build/types/TestTypes.js +44 -9
  31. package/build/utils/AnalysisStateManager.js +43 -9
  32. package/build/utils/AnalysisStateManager.test.js +35 -0
  33. package/build/utils/routeParsers.js +35 -0
  34. package/build/utils/routeParsers.test.js +66 -1
  35. package/build/utils/scenarioDrafting.js +207 -360
  36. package/build/utils/scenarioDrafting.test.js +191 -256
  37. package/build/utils/trace-parser.js +24 -6
  38. package/build/utils/trace-parser.test.js +140 -0
  39. package/node_modules/playwright/lib/mcp/browser/browserServerBackend.js +3 -0
  40. package/node_modules/playwright/lib/mcp/browser/tab.js +8 -1
  41. package/node_modules/playwright/lib/mcp/browser/tools/keyboard.js +3 -2
  42. package/node_modules/playwright/lib/mcp/browser/tools/navigate.js +1 -1
  43. package/node_modules/playwright/lib/mcp/browser/tools/snapshot.js +4 -4
  44. package/node_modules/playwright/lib/mcp/browser/tools/tabs.js +5 -4
  45. package/node_modules/playwright/lib/mcp/browser/tools/wait.js +1 -1
  46. package/node_modules/playwright/lib/mcp/skyramp/exportTool.js +10 -9
  47. package/node_modules/playwright/lib/mcp/skyramp/traceRecordingBackend.js +304 -7
  48. package/node_modules/playwright/lib/mcp/test/skyRampExport.js +128 -20
  49. package/package.json +2 -2
  50. package/node_modules/playwright/lib/mcp/terminal/help.json +0 -32
@@ -1,5 +1,5 @@
1
1
  // @ts-ignore
2
- import { nextjsFileToApiPath, parseRouteLine } from "./routeParsers.js";
2
+ import { nextjsFileToApiPath, parseRouteLine, resolveEndpointPaths } from "./routeParsers.js";
3
3
  describe("nextjsFileToApiPath", () => {
4
4
  it("converts pages/api route to API path", () => {
5
5
  expect(nextjsFileToApiPath("pages/api/users/index.ts")).toBe("/api/users");
@@ -85,3 +85,68 @@ describe("parseRouteLine", () => {
85
85
  expect(parseRouteLine("import express from 'express';", "index.ts")).toBeNull();
86
86
  });
87
87
  });
88
+ describe("resolveEndpointPaths", () => {
89
+ const knownEndpoints = [
90
+ { path: "/api/v1/orders", methods: [{ method: "POST", sourceFile: "routers/order.py" }, { method: "GET", sourceFile: "routers/order.py" }] },
91
+ { path: "/api/v1/orders/{order_id}", methods: [{ method: "GET", sourceFile: "routers/order.py" }, { method: "PUT", sourceFile: "routers/order.py" }, { method: "DELETE", sourceFile: "routers/order.py" }] },
92
+ { path: "/api/v1/products", methods: [{ method: "POST", sourceFile: "routers/product.py" }, { method: "GET", sourceFile: "routers/product.py" }] },
93
+ { path: "/api/v1/products/{product_id}", methods: [{ method: "GET", sourceFile: "routers/product.py" }, { method: "PUT", sourceFile: "routers/product.py" }, { method: "DELETE", sourceFile: "routers/product.py" }] },
94
+ ];
95
+ it("resolves router-relative path to full API path", () => {
96
+ const eps = [{ method: "PUT", path: "/{order_id}", sourceFile: "routers/order.py" }];
97
+ resolveEndpointPaths(eps, knownEndpoints);
98
+ expect(eps[0].path).toBe("/api/v1/orders/{order_id}");
99
+ });
100
+ it("leaves already-full paths unchanged", () => {
101
+ const eps = [{ method: "POST", path: "/api/v1/orders", sourceFile: "routers/order.py" }];
102
+ resolveEndpointPaths(eps, knownEndpoints);
103
+ expect(eps[0].path).toBe("/api/v1/orders");
104
+ });
105
+ it("resolves multiple endpoints in one call", () => {
106
+ const eps = [
107
+ { method: "PUT", path: "/{order_id}", sourceFile: "routers/order.py" },
108
+ { method: "DELETE", path: "/{order_id}", sourceFile: "routers/order.py" },
109
+ ];
110
+ resolveEndpointPaths(eps, knownEndpoints);
111
+ expect(eps[0].path).toBe("/api/v1/orders/{order_id}");
112
+ expect(eps[1].path).toBe("/api/v1/orders/{order_id}");
113
+ });
114
+ it("disambiguates by sourceFile when suffix matches multiple endpoints", () => {
115
+ const ambiguousKnown = [
116
+ { path: "/api/v1/orders/{id}", methods: [{ method: "PUT", sourceFile: "routers/order.py" }] },
117
+ { path: "/api/v1/products/{id}", methods: [{ method: "PUT", sourceFile: "routers/product.py" }] },
118
+ ];
119
+ const eps = [{ method: "PUT", path: "/{id}", sourceFile: "routers/order.py" }];
120
+ resolveEndpointPaths(eps, ambiguousKnown);
121
+ expect(eps[0].path).toBe("/api/v1/orders/{id}");
122
+ });
123
+ it("does not resolve when no match found", () => {
124
+ const eps = [{ method: "PATCH", path: "/{id}", sourceFile: "routers/unknown.py" }];
125
+ resolveEndpointPaths(eps, knownEndpoints);
126
+ expect(eps[0].path).toBe("/{id}");
127
+ });
128
+ it("does not resolve when ambiguous and sourceFile does not disambiguate", () => {
129
+ const ambiguousKnown = [
130
+ { path: "/api/v1/orders/{id}", methods: [{ method: "PUT" }] },
131
+ { path: "/api/v1/products/{id}", methods: [{ method: "PUT" }] },
132
+ ];
133
+ const eps = [{ method: "PUT", path: "/{id}", sourceFile: "shared.py" }];
134
+ resolveEndpointPaths(eps, ambiguousKnown);
135
+ expect(eps[0].path).toBe("/{id}");
136
+ });
137
+ it("handles empty arrays gracefully", () => {
138
+ const eps = [];
139
+ resolveEndpointPaths(eps, knownEndpoints);
140
+ expect(eps).toEqual([]);
141
+ const eps2 = [{ method: "PUT", path: "/{id}", sourceFile: "x.py" }];
142
+ resolveEndpointPaths(eps2, []);
143
+ expect(eps2[0].path).toBe("/{id}");
144
+ });
145
+ it("resolves collection-level relative paths (e.g. empty string becomes base)", () => {
146
+ const eps = [{ method: "POST", path: "", sourceFile: "routers/order.py" }];
147
+ resolveEndpointPaths(eps, knownEndpoints);
148
+ // Empty string — endsWith("") is always true, so multiple matches.
149
+ // sourceFile should disambiguate to orders.
150
+ expect(eps[0].path).toBe("/api/v1/orders");
151
+ });
152
+ });