@nbakka/mcp-appium 4.0.2 → 4.0.4
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 +43 -1
- package/package.json +1 -1
package/lib/server.js
CHANGED
|
@@ -171,6 +171,48 @@ tool(
|
|
|
171
171
|
}
|
|
172
172
|
);
|
|
173
173
|
|
|
174
|
+
tool(
|
|
175
|
+
"guidelines_to_write_code",
|
|
176
|
+
"Read coding guidelienes from ~/guardian/.cursor/rules/mcp-production-grade.json and return them so they can be followed when writing code. These guidelines include coding standards, best practices, patterns to follow, and anti-patterns to avoid. They are mandatory to follow when writing code. NOTE: Only write code after app exploration is complete and locators are fetched.",
|
|
177
|
+
{},
|
|
178
|
+
async () => {
|
|
179
|
+
try {
|
|
180
|
+
// Construct path: ~/guardian/.cursor/rules/mcp-production-grade.json
|
|
181
|
+
const guidelinesPath = path.join(os.homedir(), 'guardian', '.cursor', 'rules', 'mcp-production-grade.json');
|
|
182
|
+
|
|
183
|
+
// Read the JSON file
|
|
184
|
+
const guidelinesContent = await fs.readFile(guidelinesPath, "utf-8");
|
|
185
|
+
|
|
186
|
+
// Parse and validate JSON
|
|
187
|
+
const guidelines = JSON.parse(guidelinesContent);
|
|
188
|
+
|
|
189
|
+
// Return the guidelines content for the LLM to read and follow
|
|
190
|
+
return `📋 PRODUCTION-GRADE CODING GUIDELINES
|
|
191
|
+
|
|
192
|
+
IMPORTANT: You MUST follow these guidelines when writing ANY code:
|
|
193
|
+
|
|
194
|
+
${JSON.stringify(guidelines, null, 2)}
|
|
195
|
+
|
|
196
|
+
Instructions:
|
|
197
|
+
1. Read and understand ALL guidelines above thoroughly
|
|
198
|
+
2. Apply these guidelines to EVERY piece of code you write
|
|
199
|
+
3. Follow the specified patterns, naming conventions, and best practices
|
|
200
|
+
4. Prioritize code quality, maintainability, and consistency with these guidelines
|
|
201
|
+
|
|
202
|
+
These are mandatory requirements - not suggestions.`;
|
|
203
|
+
|
|
204
|
+
} catch (error) {
|
|
205
|
+
if (error.code === 'ENOENT') {
|
|
206
|
+
return `❌ Error: Guidelines file not found at ~/guardian/.cursor/rules/mcp-production-grade.json\n\nPlease ensure the file exists at this location in your home directory.`;
|
|
207
|
+
}
|
|
208
|
+
if (error instanceof SyntaxError) {
|
|
209
|
+
return `❌ Error: Invalid JSON in guidelines file. Please check the file format.`;
|
|
210
|
+
}
|
|
211
|
+
return `❌ Error reading coding guidelines: ${error.message}`;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
|
|
174
216
|
tool("mobile_list_elements_on_screen", "List elements on screen in a simplified, flattened structure. Returns only useful attributes: text, class, id (resource-id), accessibilityId (content-desc), and bounds. Do not cache this result.", {}, async ({}) => {
|
|
175
217
|
requireRobot();
|
|
176
218
|
const elements = await robot.getSimplifiedElements();
|
|
@@ -185,7 +227,7 @@ tool(
|
|
|
185
227
|
return `Pressed the button: ${button}`;
|
|
186
228
|
});
|
|
187
229
|
|
|
188
|
-
tool("
|
|
230
|
+
tool("mobile_open_deeplink", "Open a deeplink in app on device", {
|
|
189
231
|
url: zod_1.z.string().describe("The URL to open"),
|
|
190
232
|
}, async ({ url }) => {
|
|
191
233
|
requireRobot();
|