@skyramp/mcp 0.1.8 → 0.2.0-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 (60) hide show
  1. package/build/playwright/registerPlaywrightTools.js +12 -0
  2. package/build/playwright/traceRecordingPrompt.js +15 -0
  3. package/build/prompts/test-recommendation/diffExecutionPlan.js +31 -0
  4. package/build/prompts/test-recommendation/recommendationSections.js +1 -2
  5. package/build/prompts/test-recommendation/test-recommendation-prompt.test.js +94 -0
  6. package/build/prompts/testbot/testbot-prompts.js +115 -11
  7. package/build/prompts/testbot/testbot-prompts.test.js +79 -0
  8. package/build/resources/testbotResource.js +1 -1
  9. package/build/services/ScenarioGenerationService.integration.test.js +158 -0
  10. package/build/services/ScenarioGenerationService.js +36 -3
  11. package/build/services/ScenarioGenerationService.test.js +158 -22
  12. package/build/tools/generate-tests/generateBatchScenarioRestTool.js +16 -4
  13. package/build/tools/generate-tests/generateIntegrationRestTool.js +2 -0
  14. package/build/tools/generate-tests/generateUIRestTool.js +2 -0
  15. package/build/tools/test-management/analyzeChangesTool.js +7 -1
  16. package/build/utils/routeParsers.js +12 -0
  17. package/node_modules/playwright/ThirdPartyNotices.txt +6 -6
  18. package/node_modules/playwright/lib/dom-analyzer/analyze.js +111 -0
  19. package/node_modules/playwright/lib/dom-analyzer/blueprint.js +1161 -0
  20. package/node_modules/playwright/lib/dom-analyzer/blueprint.test.js +396 -0
  21. package/node_modules/playwright/lib/dom-analyzer/blueprintCache.js +57 -0
  22. package/node_modules/playwright/lib/dom-analyzer/blueprintCache.test.js +57 -0
  23. package/node_modules/playwright/lib/dom-analyzer/blueprintDiff.js +250 -0
  24. package/node_modules/playwright/lib/dom-analyzer/blueprintDiff.test.js +298 -0
  25. package/node_modules/playwright/lib/dom-analyzer/crawler.js +384 -0
  26. package/node_modules/playwright/lib/dom-analyzer/curatedWidgets.js +73 -0
  27. package/node_modules/playwright/lib/dom-analyzer/dynamicId.js +43 -0
  28. package/node_modules/playwright/lib/dom-analyzer/dynamicId.test.js +85 -0
  29. package/node_modules/playwright/lib/dom-analyzer/fingerprint.js +90 -0
  30. package/node_modules/playwright/lib/dom-analyzer/fingerprint.test.js +231 -0
  31. package/node_modules/playwright/lib/dom-analyzer/fingerprintAblation.fixtures.js +145 -0
  32. package/node_modules/playwright/lib/dom-analyzer/fingerprintAblation.test.js +41 -0
  33. package/node_modules/playwright/lib/dom-analyzer/graph.js +36 -0
  34. package/node_modules/playwright/lib/dom-analyzer/liveFingerprints.js +43 -0
  35. package/node_modules/playwright/lib/dom-analyzer/logicalNameResolver.js +72 -0
  36. package/node_modules/playwright/lib/dom-analyzer/logicalNameResolver.test.js +182 -0
  37. package/node_modules/playwright/lib/dom-analyzer/sectionGrouper.js +169 -0
  38. package/node_modules/playwright/lib/dom-analyzer/sectionGrouper.test.js +269 -0
  39. package/node_modules/playwright/lib/dom-analyzer/serialization.js +75 -0
  40. package/node_modules/playwright/lib/dom-analyzer/slug.js +30 -0
  41. package/node_modules/playwright/lib/dom-analyzer/slug.test.js +84 -0
  42. package/node_modules/playwright/lib/dom-analyzer/widgetContract.js +127 -0
  43. package/node_modules/playwright/lib/dom-analyzer/widgetContract.test.js +212 -0
  44. package/node_modules/playwright/lib/mcp/browser/browserContextFactory.js +3 -1
  45. package/node_modules/playwright/lib/mcp/browser/config.js +1 -1
  46. package/node_modules/playwright/lib/mcp/browser/context.js +17 -1
  47. package/node_modules/playwright/lib/mcp/browser/tab.js +38 -0
  48. package/node_modules/playwright/lib/mcp/browser/tools/domAnalyzer.js +261 -0
  49. package/node_modules/playwright/lib/mcp/browser/tools/keyboard.js +3 -3
  50. package/node_modules/playwright/lib/mcp/browser/tools/pageBlueprint.js +129 -0
  51. package/node_modules/playwright/lib/mcp/browser/tools/pageBlueprint.test.js +137 -0
  52. package/node_modules/playwright/lib/mcp/browser/tools/sitemap.js +226 -0
  53. package/node_modules/playwright/lib/mcp/browser/tools/snapshot.js +2 -2
  54. package/node_modules/playwright/lib/mcp/browser/tools/widgetContract.js +168 -0
  55. package/node_modules/playwright/lib/mcp/browser/tools.js +6 -0
  56. package/node_modules/playwright/lib/mcp/skyramp/traceRecordingBackend.js +52 -12
  57. package/node_modules/playwright/lib/mcp/test/skyRampExport.js +64 -13
  58. package/node_modules/playwright/package.json +1 -1
  59. package/node_modules/playwright/skyramp-playwright-1.58.2-skyramp.8.9.3.tgz +0 -0
  60. package/package.json +2 -2
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var analyze_exports = {};
30
+ __export(analyze_exports, {
31
+ writeSitemap: () => writeSitemap
32
+ });
33
+ module.exports = __toCommonJS(analyze_exports);
34
+ var fs = __toESM(require("fs"));
35
+ var path = __toESM(require("path"));
36
+ var import_yaml = require("yaml");
37
+ var import_utils = require("playwright-core/lib/utils");
38
+ var import_crawler = require("./crawler");
39
+ var import_blueprint = require("./blueprint");
40
+ var import_graph = require("./graph");
41
+ function writeSitemap(sitemap, outputDir, format) {
42
+ fs.mkdirSync(path.join(outputDir, "pages"), { recursive: true });
43
+ const sitemapFile = path.join(outputDir, `sitemap.${format}`);
44
+ fs.writeFileSync(sitemapFile, format === "json" ? JSON.stringify(sitemap, null, 2) : (0, import_yaml.stringify)(sitemap), "utf-8");
45
+ for (const [url, blueprint] of Object.entries(sitemap.pages)) {
46
+ const hash = (0, import_graph.urlToFilename)(url);
47
+ const canonicalFile = path.join(outputDir, "pages", `${hash}.${format}`);
48
+ fs.writeFileSync(
49
+ canonicalFile,
50
+ format === "json" ? JSON.stringify(blueprint, null, 2) : (0, import_yaml.stringify)(blueprint),
51
+ "utf-8"
52
+ );
53
+ const mapJsonFile = path.join(outputDir, "pages", `${hash}.mapJson.json`);
54
+ fs.writeFileSync(mapJsonFile, JSON.stringify((0, import_blueprint.buildMap)(blueprint), null, 2), "utf-8");
55
+ const outlineFile = path.join(outputDir, "pages", `${hash}.outline.txt`);
56
+ fs.writeFileSync(outlineFile, (0, import_blueprint.buildOutline)(blueprint), "utf-8");
57
+ }
58
+ }
59
+ if (require.main === module) {
60
+ const args = process.argv.slice(2);
61
+ const urlArg = args.find((a) => !a.startsWith("--"));
62
+ const outputDirIdx = args.indexOf("--output-dir");
63
+ const outputDir = outputDirIdx !== -1 ? args[outputDirIdx + 1] : "dom-analysis";
64
+ const depthIdx = args.indexOf("--depth");
65
+ const depth = depthIdx !== -1 ? parseInt(args[depthIdx + 1], 10) : 5;
66
+ const maxPagesIdx = args.indexOf("--max-pages");
67
+ const maxPages = maxPagesIdx !== -1 ? parseInt(args[maxPagesIdx + 1], 10) : 50;
68
+ const sameOriginOnly = !args.includes("--no-same-origin");
69
+ const probeButtonsIdx = args.indexOf("--probe-buttons");
70
+ const probeButtons = probeButtonsIdx !== -1 ? args[probeButtonsIdx + 1] : "immutable-only";
71
+ const storageStateIdx = args.indexOf("--storage-state");
72
+ const playwrightStoragePath = storageStateIdx !== -1 ? args[storageStateIdx + 1] : void 0;
73
+ const formatIdx = args.indexOf("--format");
74
+ const format = formatIdx !== -1 ? args[formatIdx + 1] : "json";
75
+ if (!urlArg) {
76
+ process.stderr.write("Usage: analyze.js <url> [--output-dir <dir>] [--depth <n>] [--max-pages <n>] [--no-same-origin] [--probe-buttons <mode>] [--storage-state <path>] [--format <json|yaml>]\n");
77
+ (0, import_utils.gracefullyProcessExitDoNotHang)(1);
78
+ }
79
+ if (!["immutable-only", "all", "none"].includes(probeButtons)) {
80
+ process.stderr.write(`Invalid --probe-buttons: ${probeButtons}. Must be one of: immutable-only, all, none
81
+ `);
82
+ (0, import_utils.gracefullyProcessExitDoNotHang)(1);
83
+ }
84
+ if (format !== "json" && format !== "yaml") {
85
+ process.stderr.write(`Invalid --format: ${format}. Must be json or yaml.
86
+ `);
87
+ (0, import_utils.gracefullyProcessExitDoNotHang)(1);
88
+ }
89
+ const run = depth > 0 ? (0, import_crawler.crawl)(urlArg, { depth, maxPages, sameOriginOnly, probeButtons, playwrightStoragePath }) : (0, import_crawler.crawlSinglePage)(urlArg, { playwrightStoragePath });
90
+ run.then((sitemap) => {
91
+ writeSitemap(sitemap, outputDir, format);
92
+ const absPath = path.resolve(outputDir, `sitemap.${format}`);
93
+ const pageCount = Object.keys(sitemap.pages).length;
94
+ process.stdout.write(`Sitemap written: ${absPath}
95
+ `);
96
+ process.stdout.write(` pages: ${pageCount}
97
+ `);
98
+ process.stdout.write(` edges: ${sitemap.edges.length}
99
+ `);
100
+ process.stdout.write(` per-page: ${path.resolve(outputDir, "pages")}/
101
+ `);
102
+ }).catch((err) => {
103
+ process.stderr.write(`Error: ${err.message}
104
+ `);
105
+ (0, import_utils.gracefullyProcessExitDoNotHang)(1);
106
+ });
107
+ }
108
+ // Annotate the CommonJS export names for ESM import in node:
109
+ 0 && (module.exports = {
110
+ writeSitemap
111
+ });