@deriv-com/fe-mcp-servers 0.0.13 → 0.0.14

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.
@@ -19449,6 +19449,51 @@ ${analysis.shouldCreateTest ? `1. Review the changed UI files above
19449
19449
  }
19450
19450
  };
19451
19451
  }
19452
+ function enforceMandatoryTemplate(yaml, name = "") {
19453
+ if (!yaml || typeof yaml !== "string") {
19454
+ yaml = "";
19455
+ }
19456
+ const mandatoryHeader = `appId: web
19457
+ name: '${name}'
19458
+ url: \${BASE_URL}
19459
+
19460
+ env:
19461
+ BASE_URL: \${MAESTRO_BASE_URL || "https://localhost:8443"}
19462
+ `;
19463
+ const hasAppIdWeb = /^appId:\s*web/m.test(yaml);
19464
+ const hasName = /^name:\s*['"]/m.test(yaml);
19465
+ const hasUrl = /^url:\s*\$\{BASE_URL\}/m.test(yaml);
19466
+ const hasEnv = /^env:\s*$/m.test(yaml);
19467
+ const hasBaseUrl = /BASE_URL:\s*\$\{MAESTRO_BASE_URL/m.test(yaml);
19468
+ if (hasAppIdWeb && hasName && hasUrl && hasEnv && hasBaseUrl) {
19469
+ if (name && yaml.match(/^name:\s*['"]\s*['"]/m)) {
19470
+ yaml = yaml.replace(/^name:\s*['"]\s*['"]/m, `name: '${name}'`);
19471
+ }
19472
+ return yaml;
19473
+ }
19474
+ let testSteps = "";
19475
+ const stepsMatch = yaml.match(/^---\s*\n([\s\S]*)$/m);
19476
+ if (stepsMatch) {
19477
+ testSteps = stepsMatch[1];
19478
+ } else {
19479
+ const stepsStart = yaml.search(
19480
+ /\n(- launchApp|- tapOn|- assertVisible|- inputText|- extendedWaitUntil)/
19481
+ );
19482
+ if (stepsStart > 0) {
19483
+ testSteps = yaml.substring(stepsStart + 1);
19484
+ } else {
19485
+ if (yaml.trim().startsWith("-")) {
19486
+ testSteps = yaml.trim();
19487
+ } else {
19488
+ testSteps = yaml.trim();
19489
+ }
19490
+ }
19491
+ }
19492
+ const enforcedYaml = `${mandatoryHeader}---
19493
+ ${testSteps.trim()}
19494
+ `;
19495
+ return enforcedYaml;
19496
+ }
19452
19497
  function writeTestFile(options = {}) {
19453
19498
  const {
19454
19499
  yaml,
@@ -19478,6 +19523,8 @@ function writeTestFile(options = {}) {
19478
19523
  message: "\u274C Missing required parameters: yaml and fileName are required"
19479
19524
  };
19480
19525
  }
19526
+ const testName = feature && action ? `${feature} - ${action}` : feature || action || "";
19527
+ const enforcedYaml = enforceMandatoryTemplate(yaml, testName);
19481
19528
  const normalizedFileName = fileName.endsWith(".yaml") ? fileName : `${fileName}.yaml`;
19482
19529
  const targetDir = join(basePath, directory);
19483
19530
  const filePath = join(targetDir, normalizedFileName);
@@ -19485,7 +19532,7 @@ function writeTestFile(options = {}) {
19485
19532
  if (!existsSync(targetDir)) {
19486
19533
  mkdirSync(targetDir, { recursive: true });
19487
19534
  }
19488
- writeFileSync(filePath, yaml, "utf-8");
19535
+ writeFileSync(filePath, enforcedYaml, "utf-8");
19489
19536
  const fd = openSync(filePath, "r");
19490
19537
  fsyncSync(fd);
19491
19538
  closeSync(fd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deriv-com/fe-mcp-servers",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "Collection of Front-End Model Context Protocol (MCP) servers for reusability and standardization",
5
5
  "type": "module",
6
6
  "bin": {