@nbakka/mcp-appium 2.0.56 → 2.0.58
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/lib/server.js +4 -7
- package/package.json +1 -1
package/lib/server.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createMcpServer = void 0;
|
|
4
4
|
const fs = require('fs').promises;
|
|
5
5
|
const os = require('os');
|
|
6
|
+
const fsSync = require('fs');
|
|
6
7
|
const path = require('path');
|
|
7
8
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
8
9
|
const zod_1 = require("zod");
|
|
@@ -575,11 +576,9 @@ tool(
|
|
|
575
576
|
await Promise.all(
|
|
576
577
|
files.map(file => fs.unlink(path.join(exportPath, file)))
|
|
577
578
|
);
|
|
578
|
-
console.log("✅ Cleared existing files in figma folder");
|
|
579
579
|
} catch (err) {
|
|
580
580
|
// Folder doesn't exist or is empty, no need to clear
|
|
581
581
|
if (err.code !== 'ENOENT') {
|
|
582
|
-
console.log("⚠️ Warning: Could not clear folder:", err.message);
|
|
583
582
|
}
|
|
584
583
|
}
|
|
585
584
|
|
|
@@ -608,11 +607,11 @@ tool(
|
|
|
608
607
|
try {
|
|
609
608
|
// Load OpenAI API key from Desktop/openai.json
|
|
610
609
|
const openaiConfigPath = path.join(os.homedir(), "Desktop", "openai.json");
|
|
611
|
-
const configContent = fs.
|
|
610
|
+
const configContent = await fs.readFile(openaiConfigPath, "utf-8");
|
|
612
611
|
const { apiKey } = JSON.parse(configContent);
|
|
613
612
|
|
|
614
613
|
const figmaDir = path.join(os.homedir(), "Desktop", "figma");
|
|
615
|
-
const files = fs.
|
|
614
|
+
const files = await fs.readdir(figmaDir);
|
|
616
615
|
const pdfFiles = files.filter(file => file.toLowerCase().endsWith('.pdf'));
|
|
617
616
|
|
|
618
617
|
if (pdfFiles.length === 0) throw new Error("No PDF files found in figma folder");
|
|
@@ -623,7 +622,7 @@ tool(
|
|
|
623
622
|
const client = new OpenAI({ apiKey });
|
|
624
623
|
|
|
625
624
|
const file = await client.files.create({
|
|
626
|
-
file:
|
|
625
|
+
file: fsSync.createReadStream(pdfPath),
|
|
627
626
|
purpose: "user_data",
|
|
628
627
|
});
|
|
629
628
|
|
|
@@ -646,8 +645,6 @@ Description: ${jiraDescription}`
|
|
|
646
645
|
|
|
647
646
|
const testCases = completion.choices[0].message.content;
|
|
648
647
|
|
|
649
|
-
await client.files.del(file.id);
|
|
650
|
-
|
|
651
648
|
return testCases;
|
|
652
649
|
} catch (err) {
|
|
653
650
|
return `Error: ${err.message}`;
|