@skyramp/mcp 0.2.3 → 0.2.5-rc.1

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 (29) hide show
  1. package/build/playwright/registerPlaywrightTools.js +21 -25
  2. package/build/playwright/traceRecordingPrompt.js +2 -2
  3. package/build/prompts/test-maintenance/actionsInstructions.js +60 -0
  4. package/build/prompts/test-maintenance/drift-analysis-prompt.js +18 -101
  5. package/build/prompts/test-maintenance/driftAnalysisSections.js +210 -171
  6. package/build/prompts/test-recommendation/analysisOutputPrompt.js +1 -1
  7. package/build/prompts/test-recommendation/diffExecutionPlan.js +4 -3
  8. package/build/prompts/test-recommendation/recommendationSections.js +6 -6
  9. package/build/prompts/test-recommendation/scopeAssessment.js +3 -1
  10. package/build/prompts/test-recommendation/scopeAssessment.test.js +13 -0
  11. package/build/prompts/test-recommendation/test-recommendation-prompt.js +2 -2
  12. package/build/prompts/test-recommendation/test-recommendation-prompt.test.js +3 -3
  13. package/build/prompts/testbot/testbot-prompts.js +21 -17
  14. package/build/prompts/testbot/testbot-prompts.test.js +21 -17
  15. package/build/services/TestDiscoveryService.js +11 -43
  16. package/build/tools/submitReportTool.js +9 -12
  17. package/build/tools/submitReportTool.test.js +4 -5
  18. package/build/tools/test-management/actionsTool.js +160 -240
  19. package/build/tools/test-management/analyzeChangesTool.js +43 -18
  20. package/build/tools/test-management/analyzeTestHealthTool.js +17 -29
  21. package/build/utils/docker.test.js +1 -1
  22. package/build/utils/versions.js +1 -1
  23. package/node_modules/playwright/lib/mcp/skyramp/common/visualSnapshot.js +95 -0
  24. package/node_modules/playwright/lib/mcp/skyramp/loadTraceTool.js +2 -0
  25. package/node_modules/playwright/lib/mcp/skyramp/traceRecordingBackend.js +150 -2
  26. package/node_modules/playwright/lib/mcp/skyramp/visualSnapshotTool.js +63 -0
  27. package/node_modules/playwright/lib/mcp/test/skyRampExport.js +36 -0
  28. package/package.json +2 -2
  29. package/build/prompts/test-maintenance/drift-analysis-prompt.test.js +0 -116
@@ -1,116 +0,0 @@
1
- import { buildDriftAnalysisPrompt } from "./drift-analysis-prompt.js";
2
- import { buildDriftOutputChecklist } from "./driftAnalysisSections.js";
3
- describe("buildDriftOutputChecklist — final-step recommendations guidance", () => {
4
- const STATE_FILE = "/tmp/skyramp-analysis-abc123.json";
5
- it("non-inline mode includes recommendations and updateInstructions in final step", () => {
6
- const checklist = buildDriftOutputChecklist(3, 0, false, STATE_FILE);
7
- // Must instruct the LLM to pass recommendations to skyramp_actions
8
- expect(checklist).toContain("recommendations");
9
- // Must mention updateInstructions so the LLM knows to populate it
10
- expect(checklist).toContain("updateInstructions");
11
- // Must reference the stateFile path
12
- expect(checklist).toContain(STATE_FILE);
13
- // Must call skyramp_actions as the final action
14
- expect(checklist).toContain("skyramp_actions");
15
- });
16
- it("non-inline mode does not contain JSON shape — schema is authoritative", () => {
17
- const checklist = buildDriftOutputChecklist(3, 0, false, STATE_FILE);
18
- // The JSON shape was moved to inputSchema — prompt must not duplicate it
19
- expect(checklist).not.toContain('"testFile":');
20
- expect(checklist).not.toContain('"action":');
21
- });
22
- it("inline mode does not reference skyramp_actions or stateFile", () => {
23
- const checklist = buildDriftOutputChecklist(3, 0, true, STATE_FILE);
24
- // Inline mode applies changes directly — no skyramp_actions call
25
- expect(checklist).not.toContain("skyramp_actions");
26
- expect(checklist).not.toContain(STATE_FILE);
27
- });
28
- it("full prompt (non-inline) includes recommendations guidance", () => {
29
- const prompt = buildDriftAnalysisPrompt({
30
- existingTests: [],
31
- scannedEndpoints: [],
32
- repositoryPath: "/repo",
33
- stateFile: STATE_FILE,
34
- });
35
- expect(prompt).toContain("recommendations");
36
- expect(prompt).toContain("updateInstructions");
37
- });
38
- });
39
- describe("buildDriftAnalysisPrompt - inline mode", () => {
40
- beforeEach(() => { process.env.SKYRAMP_FEATURE_TESTBOT = "1"; });
41
- afterEach(() => { delete process.env.SKYRAMP_FEATURE_TESTBOT; });
42
- function inlinePrompt() {
43
- return buildDriftAnalysisPrompt({
44
- existingTests: [],
45
- scannedEndpoints: [],
46
- repositoryPath: "/repo",
47
- // stateFile omitted → inline mode
48
- });
49
- }
50
- it("wraps inline rules in drift_analysis_rules XML tags", () => {
51
- const prompt = inlinePrompt();
52
- expect(prompt).toContain("<drift_analysis_rules>");
53
- expect(prompt).toContain("</drift_analysis_rules>");
54
- });
55
- it("does not contain the persona statement", () => {
56
- const prompt = inlinePrompt();
57
- expect(prompt).not.toContain("You are acting as a Skyramp Integration Architect");
58
- });
59
- it("does not contain the standalone Test Health Analysis header", () => {
60
- const prompt = inlinePrompt();
61
- expect(prompt).not.toContain("# Test Health Analysis");
62
- });
63
- it("does not contain the skyramp_actions CTA (that belongs to standalone mode)", () => {
64
- const prompt = inlinePrompt();
65
- // Inline mode final step directs applying changes directly, not calling skyramp_actions
66
- expect(prompt).not.toContain("call `skyramp_actions`");
67
- });
68
- });
69
- describe("buildDriftAnalysisPrompt - scanned endpoints rendering", () => {
70
- // Reproduces the [object Object] bug: skeletonEndpoints from analyzeChangesTool
71
- // stores methods as objects { method: string, ... }, not plain strings.
72
- const skeletonMethodObjects = [
73
- {
74
- path: "/api/v1/",
75
- methods: [{ method: "GET", description: "", queryParams: [], authRequired: true, sourceFile: "main.py", interactions: [] }],
76
- resourceGroup: "v1",
77
- pathParams: [],
78
- },
79
- {
80
- path: "/api/v1/orders",
81
- methods: [
82
- { method: "GET", description: "", queryParams: [], authRequired: true, sourceFile: "orders.py", interactions: [] },
83
- { method: "POST", description: "", queryParams: [], authRequired: true, sourceFile: "orders.py", interactions: [] },
84
- ],
85
- resourceGroup: "orders",
86
- pathParams: [],
87
- },
88
- ];
89
- it("renders HTTP methods as strings, not [object Object]", () => {
90
- const prompt = buildDriftAnalysisPrompt({
91
- existingTests: [],
92
- scannedEndpoints: skeletonMethodObjects,
93
- repositoryPath: "/repo",
94
- stateFile: "/tmp/state.json",
95
- });
96
- expect(prompt).not.toContain("[object Object]");
97
- expect(prompt).toContain("GET /api/v1/");
98
- expect(prompt).toContain("GET|POST /api/v1/orders");
99
- // CTA should appear exactly once (not duplicated)
100
- const ctaCount = (prompt.match(/call `skyramp_actions`/g) || []).length;
101
- expect(ctaCount).toBe(1);
102
- });
103
- it("also works with plain string methods (ScannedEndpoint format)", () => {
104
- const stringMethods = [
105
- { path: "/api/v1/products", methods: ["GET", "POST"], sourceFile: "products.py" },
106
- ];
107
- const prompt = buildDriftAnalysisPrompt({
108
- existingTests: [],
109
- scannedEndpoints: stringMethods,
110
- repositoryPath: "/repo",
111
- stateFile: "/tmp/state.json",
112
- });
113
- expect(prompt).not.toContain("[object Object]");
114
- expect(prompt).toContain("GET|POST /api/v1/products");
115
- });
116
- });